craigmcc 2003/02/04 16:49:22
Modified: beanutils/src/test/org/apache/commons/beanutils
BeanUtilsTestCase.java
Log:
Check setProperty() as well as copyProperty() for write-onyl property
support.
Revision Changes Path
1.22 +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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- BeanUtilsTestCase.java 5 Feb 2003 00:45:53 -0000 1.21
+++ BeanUtilsTestCase.java 5 Feb 2003 00:49:22 -0000 1.22
@@ -1231,6 +1231,25 @@
}
+ /**
+ * Test setting a new value to a write-only property, with and without
+ * conversions.
+ */
+ public void testSetPropertyWriteOnly() throws Exception {
+
+ bean.setWriteOnlyProperty("Original value");
+
+ // No conversion required
+ BeanUtils.setProperty(bean, "writeOnlyProperty", "New value");
+ assertEquals("New value", bean.getWriteOnlyPropertyValue());
+
+ // Integer->String conversion required
+ BeanUtils.setProperty(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]