You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stian Soiland-Reyes (JIRA)" <ji...@apache.org> on 2016/09/12 14:13:20 UTC

[jira] [Comment Edited] (BEANUTILS-492) IndexedPropertyDescriptor not supported for List in Java 8

    [ https://issues.apache.org/jira/browse/BEANUTILS-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15484229#comment-15484229 ] 

Stian Soiland-Reyes edited comment on BEANUTILS-492 at 9/12/16 2:12 PM:
------------------------------------------------------------------------

Two tests I can't seem to fix:

{code}
    public void testListIndexedWriteMethod() throws Exception {    	
        final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringList");
        assertNotNull("stringList descriptor not found", descriptor);
		Assume.assumeTrue(BEANUTILS_492, descriptor instanceof IndexedPropertyDescriptor);
        assertNotNull("No List Indexed Write Method", ((IndexedPropertyDescriptor)descriptor).getIndexedWriteMethod());
    }
    public void testListIndexedReadMethod() throws Exception {
        final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringList");
        assertNotNull("stringList descriptor not found", descriptor);
        Assume.assumeTrue(BEANUTILS_492, descriptor instanceof IndexedPropertyDescriptor);
        assertNotNull("No List Indexed Read Method",  ((IndexedPropertyDescriptor)descriptor).getIndexedReadMethod());
    }
{code}

but strangely I get:

{code}
Tests in error: 
  IndexedPropertyTestCase.testListIndexedReadMethod:288 » AssumptionViolated BEA...
  IndexedPropertyTestCase.testListIndexedWriteMethod:298 » AssumptionViolated BE...
{code}

How do I get the assumption fail to just ignore the test?

(These tests also seem to do weird things like try...catch Exception ex { fail(ex)   instead of just letting junit catch the exception.)


was (Author: stain):
Two tests I can't seem to 

{code}
    public void testListIndexedWriteMethod() throws Exception {    	
        final PropertyDescriptor descriptor = propertyUtilsBean.getPropertyDescriptor(bean, "stringList");
        assertNotNull("stringList descriptor not found", descriptor);
		Assume.assumeTrue(BEANUTILS_492, descriptor instanceof IndexedPropertyDescriptor);
        assertNotNull("No List Indexed Write Method", ((IndexedPropertyDescriptor)descriptor).getIndexedWriteMethod());
    }
{code}

but strangely I get:

{code}
Tests in error: 
  IndexedPropertyTestCase.testListIndexedReadMethod:288 » AssumptionViolated BEA...
  IndexedPropertyTestCase.testListIndexedWriteMethod:298 » AssumptionViolated BE...
{code}

How do I get the assumption fail to just ignore the test?

(These tests also seem to do weird things like try...catch Exception ex { fail(ex)   instead of just letting junit catch the exception.)

> IndexedPropertyDescriptor not supported for List in Java 8
> ----------------------------------------------------------
>
>                 Key: BEANUTILS-492
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-492
>             Project: Commons BeanUtils
>          Issue Type: Bug
>    Affects Versions: 1.9.3
>         Environment: maven:3.3-jdk8
>            Reporter: Stian Soiland-Reyes
>            Assignee: Stian Soiland-Reyes
>            Priority: Critical
>             Fix For: 1.9.3
>
>
> With MAven 3.3 and JDK 8, Common Beanutils fails:
> https://builds.apache.org/view/Apache%20Commons/job/Commons%20Beanutils%20docker/4/console
> {code}
> Failed tests: 
>   IndexedPropertyTestCase.testArrayListIndexedPropertyDescriptor:175 Not IndexedPropertyDescriptor expected:<class java.beans.IndexedPropertyDescriptor> but was:<class java.beans.PropertyDescriptor>
>   IndexedPropertyTestCase.testArrayListReadMethod:316 Threw exception java.lang.ClassCastException: java.beans.PropertyDescriptor cannot be cast to java.beans.IndexedPropertyDescriptor
>   IndexedPropertyTestCase.testArrayListWriteMethod:330 Threw exception java.lang.ClassCastException: java.beans.PropertyDescriptor cannot be cast to java.beans.IndexedPropertyDescriptor
>   IndexedPropertyTestCase.testListIndexedPropertyDescriptor:156 Not IndexedPropertyDescriptor expected:<class java.beans.IndexedPropertyDescriptor> but was:<class java.beans.PropertyDescriptor>
>   IndexedPropertyTestCase.testListIndexedReadMethod:288 Threw exception java.lang.ClassCastException: java.beans.PropertyDescriptor cannot be cast to java.beans.IndexedPropertyDescriptor
>   IndexedPropertyTestCase.testListIndexedWriteMethod:302 Threw exception java.lang.ClassCastException: java.beans.PropertyDescriptor cannot be cast to java.beans.IndexedPropertyDescriptor
>   IndexedPropertyTestCase.testListReadMethod:256 Threw exception java.lang.ClassCastException: java.beans.PropertyDescriptor cannot be cast to java.beans.IndexedPropertyDescriptor
>   IndexedPropertyTestCase.testListWriteMethod:274 Threw exception java.lang.ClassCastException: java.beans.PropertyDescriptor cannot be cast to java.beans.IndexedPropertyDescriptor
>   Jira422TestCase.testRootBean:36 expected:<java.[lang.String]> but was:<java.[util.List]>
>   Jira422TestCase.testSecondChildBean:42 expected:<java.[lang.String]> but was:<java.[util.List]>
> {code}
> It seems some assumptions about java.beans.PropertyDescriptor implementation are no longer true in JDK 8.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)