commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-commons/beanutils/src/test/org/apache/commons/beanutils PropertyUtilsTestCase.java
Date Tue, 29 Oct 2002 20:27:53 GMT
craigmcc    2002/10/29 12:27:53

  Modified:    beanutils/src/test/org/apache/commons/beanutils
                        PropertyUtilsTestCase.java
  Log:
  Add unit tests to prove that PropertyUtils.getPropertyType() functions
  correctly on nested property names, with no need for a patch.
  
  PR: Bugzilla #13743
  Submitted by:	Andrea Aime <aaime at libero.it>
  
  Revision  Changes    Path
  1.27      +45 -4     jakarta-commons/beanutils/src/test/org/apache/commons/beanutils/PropertyUtilsTestCase.java
  
  Index: PropertyUtilsTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/beanutils/src/test/org/apache/commons/beanutils/PropertyUtilsTestCase.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- PropertyUtilsTestCase.java	27 Oct 2002 16:50:18 -0000	1.26
  +++ PropertyUtilsTestCase.java	29 Oct 2002 20:27:53 -0000	1.27
  @@ -1542,6 +1542,8 @@
           String stringArray[] = new String[0];
   
           try {
  +
  +            // Scalar and Indexed Properties
               clazz = PropertyUtils.getPropertyType(bean, "booleanProperty");
               assertEquals("booleanProperty type", Boolean.TYPE, clazz);
               clazz = PropertyUtils.getPropertyType(bean, "booleanSecond");
  @@ -1578,6 +1580,45 @@
               assertEquals("stringProperty type", String.class, clazz);
               clazz = PropertyUtils.getPropertyType(bean, "writeOnlyProperty");
               assertEquals("writeOnlyProperty type", String.class, clazz);
  +
  +            // Nested Properties
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.booleanProperty");
  +            assertEquals("booleanProperty type", Boolean.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.booleanSecond");
  +            assertEquals("booleanSecond type", Boolean.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.doubleProperty");
  +            assertEquals("doubleProperty type", Double.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.dupProperty");
  +            assertEquals("dupProperty type", String.class, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.floatProperty");
  +            assertEquals("floatProperty type", Float.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.intArray");
  +            assertEquals("intArray type", intArray.getClass(), clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.intIndexed");
  +            assertEquals("intIndexed type", Integer.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.intProperty");
  +            assertEquals("intProperty type", Integer.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.listIndexed");
  +            assertEquals("listIndexed type", List.class, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.longProperty");
  +            assertEquals("longProperty type", Long.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.mappedProperty");
  +            assertEquals("mappedProperty type", String.class, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.mappedIntProperty");
  +            assertEquals("mappedIntProperty type", Integer.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.readOnlyProperty");
  +            assertEquals("readOnlyProperty type", String.class, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.shortProperty");
  +            assertEquals("shortProperty type", Short.TYPE, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.stringArray");
  +            assertEquals("stringArray type", stringArray.getClass(), clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.stringIndexed");
  +            assertEquals("stringIndexed type", String.class, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.stringProperty");
  +            assertEquals("stringProperty type", String.class, clazz);
  +            clazz = PropertyUtils.getPropertyType(bean, "nested.writeOnlyProperty");
  +            assertEquals("writeOnlyProperty type", String.class, clazz);
  +
           } catch (Exception e) {
               fail("Exception: " + e.getMessage());
           }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message