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 BeanUtilsTestCase.java
Date Wed, 05 Feb 2003 00:45:53 GMT
craigmcc    2003/02/04 16:45:53

  Modified:    beanutils/src/test/org/apache/commons/beanutils
                        BeanUtilsTestCase.java
  Log:
  Ensure that copyProperty() allows you to set a write-only property.
  
  Revision  Changes    Path
  1.21      +23 -4     jakarta-commons/beanutils/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java
  
  Index: BeanUtilsTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/beanutils/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- BeanUtilsTestCase.java	4 Feb 2003 07:28:14 -0000	1.20
  +++ BeanUtilsTestCase.java	5 Feb 2003 00:45:53 -0000	1.21
  @@ -1212,6 +1212,25 @@
       }
   
   
  +    /**
  +     * Test copying a new value to a write-only property, with and without
  +     * conversions.
  +     */
  +    public void testCopyPropertyWriteOnly() throws Exception {
  +
  +        bean.setWriteOnlyProperty("Original value");
  +
  +        // No conversion required
  +        BeanUtils.copyProperty(bean, "writeOnlyProperty", "New value");
  +        assertEquals("New value", bean.getWriteOnlyPropertyValue());
  +
  +        // Integer->String conversion required
  +        BeanUtils.copyProperty(bean, "writeOnlyProperty", new Integer(123));
  +        assertEquals("123", bean.getWriteOnlyPropertyValue());
  +
  +    }
  +
  +
       // Ensure that the actual int[] matches the expected int[]
       protected void checkIntArray(int actual[], int expected[]) {
           assertNotNull("actual array not null", actual);
  
  
  

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


Mime
View raw message