commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r332485 - in /jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils: MappedPropertyTestBean.java MappedPropertyTestCase.java
Date Fri, 11 Nov 2005 08:17:44 GMT
Author: niallp
Date: Fri Nov 11 00:17:34 2005
New Revision: 332485

URL: http://svn.apache.org/viewcvs?rev=332485&view=rev
Log:
Investigate Bug 23383 - Add test for MappedPropertyDescriptor with different types on get/set
methods.

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

Modified: jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestBean.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestBean.java?rev=332485&r1=332484&r2=332485&view=diff
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestBean.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestBean.java
Fri Nov 11 00:17:34 2005
@@ -78,4 +78,11 @@
     public void setInvalidSetter(String key, String value, String other) {	
     }
 
+    public Long getDifferentTypes(String key) {
+        return new Long(((Number)map.get(key)).longValue());
+    }
+    public void setDifferentTypes(String key, Integer value) {	
+        map.put(key, value);
+    }
+
 }

Modified: jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestCase.java?rev=332485&r1=332484&r2=332485&view=diff
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestCase.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/MappedPropertyTestCase.java
Fri Nov 11 00:17:34 2005
@@ -169,6 +169,27 @@
     }
 
     /**
+     * Test Mapped Property - Different Types
+     *
+     * Expect to find the getDifferentTypes() method, but not
+     * the setDifferentTypes() method because setDifferentTypes()
+     * sets and Integer, while getDifferentTypes() returns a Long.
+     */
+    public void testDifferentTypes() {
+        String property = "differentTypes";
+        Class clazz = MappedPropertyTestBean.class;
+        try {
+            MappedPropertyDescriptor desc 
+                = new MappedPropertyDescriptor(property, clazz);
+            assertNotNull("Getter is missing", desc.getMappedReadMethod());
+            assertNull("Setter is found", desc.getMappedWriteMethod());
+        } catch (Exception ex) {
+            fail("Property '" + property + "' Not Found in " + clazz.getName() + ": " + ex);
+        }
+    }
+
+
+    /**
      * Test property with any two args
      */
     public void testAnyArgsProperty() {



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