commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r539845 - /jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java
Date Sun, 20 May 2007 08:46:21 GMT
Author: niallp
Date: Sun May 20 01:46:20 2007
New Revision: 539845

URL: http://svn.apache.org/viewvc?view=rev&rev=539845
Log:
Add test for BEANUTILS-65 (ConvertUtils supports String->String[], but BeanUtils does not
call the converter) - resolved by BEANUTILS-258

Modified:
    jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java

Modified: jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java?view=diff&rev=539845&r1=539844&r2=539845
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/BeanUtilsTestCase.java
Sun May 20 01:46:20 2007
@@ -976,6 +976,27 @@
 
     }
 
+    /**
+     * Test setting a String value to a String array property
+     */
+    public void testSetPropertyStringToArray() throws Exception {
+        BeanUtils.setProperty(bean, "stringArray", "ABC,DEF,GHI");
+        String[] strArray =  bean.getStringArray();
+        assertEquals("length", 3, strArray.length);
+        assertEquals("value[0]", "ABC", strArray[0]);
+        assertEquals("value[1]", "DEF", strArray[1]);
+        assertEquals("value[2]", "GHI", strArray[2]);
+
+        BeanUtils.setProperty(bean, "intArray", "0, 10, 20, 30, 40");
+        int[] intArray =  bean.getIntArray();
+        assertEquals("length", 5, intArray.length);
+        assertEquals("value[0]", 0, intArray[0]);
+        assertEquals("value[1]", 10, intArray[1]);
+        assertEquals("value[2]", 20, intArray[2]);
+        assertEquals("value[3]", 30, intArray[3]);
+        assertEquals("value[4]", 40, intArray[4]);
+    }
+
 
     /**
      * Test narrowing and widening conversions on byte.



---------------------------------------------------------------------
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