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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]