commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1540186 [6/6] - in /commons/proper/beanutils/trunk: ./ src/changes/ src/main/java/org/apache/commons/beanutils/ src/main/java/org/apache/commons/beanutils/converters/ src/main/java/org/apache/commons/beanutils/locale/ src/test/java/org/apa...
Date Fri, 08 Nov 2013 21:08:33 GMT
Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira157TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira157TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira157TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira157TestCase.java Fri Nov  8 21:08:30 2013
@@ -94,14 +94,18 @@ public class Jira157TestCase extends Tes
      */
     public void testIssue_BEANUTILS_157_BeanUtils_Describe_Serializable() {
         Object bean = new Serializable() {
+            private static final long serialVersionUID = 1L;
+
+            @SuppressWarnings("unused")
             public String getX() {
                 return "x-value";
             }
+            @SuppressWarnings("unused")
             public String getY() {
                 return "y-value";
             }
         };
-        Map result = null;
+        Map<String, String> result = null;
         try {
             result = BeanUtils.describe(bean);
         } catch (Throwable t) {
@@ -127,7 +131,7 @@ public class Jira157TestCase extends Tes
                 return "y-value";
             }
         };
-        Map result = null;
+        Map<String, String> result = null;
         try {
             result = BeanUtils.describe(bean);
         } catch (Throwable t) {
@@ -150,7 +154,7 @@ public class Jira157TestCase extends Tes
      */
     public void testIssue_BEANUTILS_157_BeanUtils_Describe_Bean() {
         Object bean = new FooBar();
-        Map result = null;
+        Map<String, String> result = null;
         try {
             result = BeanUtils.describe(bean);
         } catch (Throwable t) {
@@ -172,6 +176,7 @@ public class Jira157TestCase extends Tes
         String getPackageFoo() {
             return "Package Value";
         }
+        @SuppressWarnings("unused")
         private String getPrivateFoo() {
             return "PrivateFoo Value";
         }

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira298TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira298TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira298TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira298TestCase.java Fri Nov  8 21:08:30 2013
@@ -122,7 +122,7 @@ public class Jira298TestCase extends Tes
         Object result = null;
         try {
             Method m2 = MethodUtils.getAccessibleMethod(bean.getClass(), "getName", new Class[0]);
-            result = m2.invoke(bean, null);
+            result = m2.invoke(bean);
         } catch (Throwable t) {
             log.error("Failed: " + t.getMessage(), t);
             fail("Threw exception: " + t);

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira339TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira339TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira339TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira339TestCase.java Fri Nov  8 21:08:30 2013
@@ -106,7 +106,7 @@ public class Jira339TestCase extends Tes
 
         TestBean bean = new TestBean();
         try {
-            Map properties = new HashMap();
+            Map<String, Object> properties = new HashMap<String, Object>();
             properties.put("comparator", null);
             BeanUtils.populate(bean, properties);
         } catch (Throwable t) {
@@ -120,14 +120,14 @@ public class Jira339TestCase extends Tes
      * Test Bean.
      */
     public static class TestBean {
-        private Comparator comparator;
+        private Comparator<?> comparator;
 
         /**
          * Return the comparator.
          *
          * @return the comparator
          */
-        public Comparator getComparator() {
+        public Comparator<?> getComparator() {
             return comparator;
         }
 
@@ -136,7 +136,7 @@ public class Jira339TestCase extends Tes
          *
          * @param comparator the comparator
          */
-        public void setComparator(Comparator comparator) {
+        public void setComparator(Comparator<?> comparator) {
             this.comparator = comparator;
         }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira347TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira347TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira347TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira347TestCase.java Fri Nov  8 21:08:30 2013
@@ -22,6 +22,7 @@ import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.ArrayList;
 
 import junit.framework.TestCase;
 
@@ -51,8 +52,8 @@ public class Jira347TestCase extends Tes
     public void testMappedPropertyDescriptor_AnyArgsProperty() throws Exception {
         String className = "org.apache.commons.beanutils.MappedPropertyTestBean";
         ClassLoader loader = newClassLoader();
-        Class beanClass    = loader.loadClass(className);
-        Object bean        = beanClass.newInstance();
+        Class<?> beanClass    = loader.loadClass(className);
+        beanClass.newInstance();
         // -----------------------------------------------------------------------------
 
         // Sanity checks only
@@ -102,10 +103,10 @@ public class Jira347TestCase extends Tes
      */
     private void forceGarbageCollection() throws Exception {
         // Fill up memory
-        SoftReference ref = new SoftReference(new Object());
+        SoftReference<Object> ref = new SoftReference<Object>(new Object());
         int count = 0;
         while(ref.get() != null && count++ < 5) {
-            java.util.ArrayList list = new java.util.ArrayList();
+            ArrayList<Object> list = new ArrayList<Object>();
             try {
                 long i = 0;
                 while (true && ref.get() != null) {

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira357TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira357TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira357TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira357TestCase.java Fri Nov  8 21:08:30 2013
@@ -105,7 +105,7 @@ public class Jira357TestCase extends Tes
     /**
      * Test {@link PropertyUtils#getPropertyDescriptors(Class)}
      */
-    private void checkReadMethod(String propertyName, Class expectedDeclaringClass) throws Exception {
+    private void checkReadMethod(String propertyName, Class<?> expectedDeclaringClass) throws Exception {
 
         PropertyDescriptor[] descriptors = null;
         try {

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira381TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira381TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira381TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira381TestCase.java Fri Nov  8 21:08:30 2013
@@ -48,9 +48,9 @@ public class Jira381TestCase extends Tes
      */
     public void testIssue_BEANUTILS_381_getMatchingAccessibleMethod() {
 
-        Class target = TestServiceBean.class;
+        Class<?> target = TestServiceBean.class;
         String methodName = "performOp";
-        Class[] runtimeClasses = new Class[]{TestObjectSubclass.class};
+        Class<?>[] runtimeClasses = new Class<?>[]{TestObjectSubclass.class};
 
         Method returned = MethodUtils.getMatchingAccessibleMethod(target, methodName, runtimeClasses);
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira422TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira422TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira422TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira422TestCase.java Fri Nov  8 21:08:30 2013
@@ -32,18 +32,19 @@ public class Jira422TestCase extends Tes
 
     public void testRootBean() throws Exception {
         RootBean bean = new FirstChildBean();
-        Class propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
+        Class<?> propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
         assertEquals(String.class.getName(), propertyType.getName());
     }
 
     public void testSecondChildBean() throws Exception {
         RootBean bean = new SecondChildBean();
-        Class propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
+        Class<?> propertyType = PropertyUtils.getPropertyType(bean, "file[0]");
         assertEquals(String.class.getName(), propertyType.getName());
     }
 
 }
 
+@SuppressWarnings("rawtypes")
 class RootBean {
 
     private List file;
@@ -60,6 +61,7 @@ class RootBean {
         return (String) file.get(i);
     }
 
+    @SuppressWarnings("unchecked")
     public void setFile(int i, String file) {
         this.file.set(i, file);
     }

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira61TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira61TestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira61TestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/Jira61TestCase.java Fri Nov  8 21:08:30 2013
@@ -403,7 +403,7 @@ public class Jira61TestCase extends Test
      */
     public void testIssue_BEANUTILS_61_PropertyUtils_copyProperties_to_WrapDynaBean() {
         String value = "copied simpleReadOnly";
-        Map source = new HashMap();
+        Map<String, Object> source = new HashMap<String, Object>();
         source.put("simpleReadOnly", value);
         try {
             PropertyUtils.copyProperties(wrapDynaBean, source);
@@ -437,7 +437,7 @@ public class Jira61TestCase extends Test
      */
     public void testIssue_BEANUTILS_61_BeanUtils_copyProperties_to_WrapDynaBean() {
         String value = "copied simpleReadOnly";
-        Map source = new HashMap();
+        Map<String, Object> source = new HashMap<String, Object>();
         source.put("simpleReadOnly", value);
         try {
             BeanUtils.copyProperties(wrapDynaBean, source);

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira18BeanFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira18BeanFactory.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira18BeanFactory.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira18BeanFactory.java Fri Nov  8 21:08:30 2013
@@ -22,7 +22,7 @@ import java.util.Map;
 import org.apache.commons.beanutils.bugs.Jira18TestCase;
 
 /**
- * Factory whcih creates <i>package</i> scope beans with
+ * Factory which creates <i>package</i> scope beans with
  * public methods for {@link Jira18TestCase}.
  *
  * @version $Id$
@@ -43,7 +43,7 @@ public class Jira18BeanFactory {
 
         private final String[] indexed = new String[] {"one", "two", "three"};
         private String simple = "FOO";
-        private final Map mapped = new HashMap();
+        private final Map<String, Object> mapped = new HashMap<String, Object>();
 
         /** Default Constructor */
         public PackageFriendlyBean() {

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira61BeanFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira61BeanFactory.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira61BeanFactory.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/bugs/other/Jira61BeanFactory.java Fri Nov  8 21:08:30 2013
@@ -44,7 +44,7 @@ public class Jira61BeanFactory {
 
         private final String[] indexed = new String[] {"one", "two", "three"};
         private String simple = "FOO";
-        private final Map mapped = new HashMap();
+        private final Map<String, Object> mapped = new HashMap<String, Object>();
 
         /** Default Constructor */
         public TestBean() {

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ArrayConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ArrayConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ArrayConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ArrayConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -81,8 +81,8 @@ public class ArrayConverterTestCase exte
         long[]    longArray    = new long[] {intArray[0], intArray[1], intArray[2], intArray[3]};
         Long[]    LONGArray    = new Long[]    {new Long(intArray[0]),    new Long(intArray[1]),    new Long(intArray[2]),    new Long(intArray[3])};
         Integer[] IntegerArray = new Integer[] {new Integer(intArray[0]), new Integer(intArray[1]), new Integer(intArray[2]), new Integer(intArray[3])};
-        ArrayList strList = new ArrayList();
-        ArrayList longList = new ArrayList();
+        ArrayList<String> strList = new ArrayList<String>();
+        ArrayList<Long> longList = new ArrayList<Long>();
         for (int i = 0; i < strArray.length; i++) {
             strList.add(strArray[i]);
             longList.add(LONGArray[i]);
@@ -216,7 +216,7 @@ public class ArrayConverterTestCase exte
 
         // Test Data
         String[] array = new String[] {"10", "  11", "12  ", "  13  "};
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         for (int i = 0; i < array.length; i++) {
             list.add(array[i]);
         }
@@ -368,7 +368,7 @@ public class ArrayConverterTestCase exte
         ArrayConverter converter = new ArrayConverter(String[].class, new StringConverter());
 
         // test underscore not allowed (the default)
-        String[] result = (String[])converter.convert(String[].class, value);
+        String[] result = converter.convert(String[].class, value);
         assertNotNull("result.null", result);
         assertEquals("result.length", 4, result.length);
         assertEquals("result[0]", "first", result[0]);
@@ -380,7 +380,7 @@ public class ArrayConverterTestCase exte
         converter.setAllowedChars(new char[] {'.', '-', '_'});
 
         // test underscore allowed
-        result = (String[])converter.convert(String[].class, value);
+        result = converter.convert(String[].class, value);
         assertNotNull("result.null", result);
         assertEquals("result.length", 2, result.length);
         assertEquals("result[0]", "first_value", result[0]);

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigDecimalConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigDecimalConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigDecimalConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigDecimalConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -73,7 +73,7 @@ public class BigDecimalConverterTestCase
     }
 
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return BigDecimal.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigIntegerConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigIntegerConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigIntegerConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BigIntegerConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -72,7 +72,7 @@ public class BigIntegerConverterTestCase
     }
 
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return BigInteger.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BooleanConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BooleanConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BooleanConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/BooleanConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -17,10 +17,10 @@
 
 package org.apache.commons.beanutils.converters;
 
-import org.apache.commons.beanutils.ConversionException;
-
 import junit.framework.TestCase;
 
+import org.apache.commons.beanutils.ConversionException;
+
 /**
  * @version $Id$
  */
@@ -95,6 +95,26 @@ public class BooleanConverterTestCase ex
         }
     }
 
+    /**
+     * Tests a conversion to another target type. This should not be possible.
+     */
+    public void testConversionToOtherType() {
+        BooleanConverter converter = new BooleanConverter();
+        try {
+            converter.convert(Integer.class, STANDARD_TRUES[0]);
+            fail("Could convert to unsupported type!");
+        } catch (ConversionException cex) {
+            // Expected result
+        }
+    }
+
+    /**
+     * Tests whether a conversion to a primitive boolean is possible.
+     */
+    public void testPrimitiveTargetClass() {
+        BooleanConverter converter = new BooleanConverter();
+        assertTrue("Wrong result", converter.convert(Boolean.TYPE, STANDARD_TRUES[0]));
+    }
 
     protected void testConversionValues(BooleanConverter converter,
             String[] trueValues, String[] falseValues) {

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ByteConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ByteConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ByteConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ByteConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -70,7 +70,7 @@ public class ByteConverterTestCase exten
         return new ByteConverter(defaultValue);
     }
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Byte.class;
     }
 
@@ -137,7 +137,7 @@ public class ByteConverterTestCase exten
      */
     public void testInvalidAmount() {
         Converter converter = makeConverter();
-        Class clazz = Byte.class;
+        Class<?> clazz = Byte.class;
 
         Long min         = new Long(Byte.MIN_VALUE);
         Long max         = new Long(Byte.MAX_VALUE);

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CalendarConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CalendarConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CalendarConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CalendarConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -17,6 +17,7 @@
 package org.apache.commons.beanutils.converters;
 
 import java.util.Calendar;
+
 import junit.framework.TestSuite;
 
 /**
@@ -69,7 +70,7 @@ public class CalendarConverterTestCase e
      * @return The expected type
      */
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Calendar.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CharacterConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CharacterConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CharacterConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/CharacterConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -19,6 +19,7 @@ package org.apache.commons.beanutils.con
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.commons.beanutils.ConversionException;
 import org.apache.commons.beanutils.Converter;
 
 /**
@@ -80,6 +81,22 @@ public class CharacterConverterTestCase 
         assertEquals("Character Test", new Character('N'), converter.convert(Character.class, new Character('N')));
         assertEquals("String Test",    new Character('F'), converter.convert(Character.class, "FOO"));
         assertEquals("Integer Test",   new Character('3'), converter.convert(Character.class, new Integer(321)));
+    }
+
+    /**
+     * Tests whether the primitive char class can be passed as target type.
+     */
+    public void testConvertToChar() {
+        Converter converter = new CharacterConverter();
+        assertEquals("Wrong result", new Character('F'), converter.convert(Character.TYPE, "FOO"));
+    }
+
+    /**
+     * Tests a conversion to character for null input if no default value is
+     * provided.
+     */
+    public void testConvertToCharacterNullNoDefault() {
+        Converter converter = new CharacterConverter();
         try {
             converter.convert(Character.class, null);
             fail("Expected a ConversionException for null value");
@@ -95,4 +112,17 @@ public class CharacterConverterTestCase 
         Converter converter = new CharacterConverter("C");
         assertEquals("Default Test",   new Character('C'), converter.convert(Character.class, null));
     }
+
+    /**
+     * Tries a conversion to an unsupported type.
+     */
+    public void testConvertToUnsupportedType() {
+        Converter converter = new CharacterConverter();
+        try {
+            converter.convert(Integer.class, "Test");
+            fail("Could convert to unsupported type!");
+        } catch (ConversionException cex) {
+            // expected result
+        }
+    }
 }

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -150,4 +150,16 @@ public class ClassConverterTestCase exte
         }
     }
 
+    /**
+     * Tries a conversion to an unsupported target type.
+     */
+    public void testUnsupportedTargetType() {
+        Converter converter = new ClassConverter();
+        try {
+            converter.convert(Integer.class, getClass().getName());
+            fail("Invalid target class not detected!");
+        } catch (ConversionException cex) {
+            // expected result
+        }
+    }
 }

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloader.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloader.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloader.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloader.java Fri Nov  8 21:08:30 2013
@@ -17,10 +17,10 @@
 
 package org.apache.commons.beanutils.converters;
 
-import java.io.InputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 
 /**
  * A special classloader useful for testing j2ee-like scenarios.
@@ -55,7 +55,7 @@ public class ClassReloader extends Class
      * Given a class already in the classpath of a parent classloader,
      * reload that class via this classloader.
      */
-    public Class reload(Class clazz) throws FileNotFoundException, IOException {
+    public Class<?> reload(Class<?> clazz) throws FileNotFoundException, IOException {
         String className = clazz.getName();
         String classFile = className.replace('.', '/') + ".class";
         InputStream classStream = getParent().getResourceAsStream(classFile);
@@ -77,7 +77,7 @@ public class ClassReloader extends Class
         byte[] classData = baos.toByteArray();
 
         // now we have the raw class data, let's turn it into a class
-        Class newClass = defineClass(className, classData, 0, classData.length);
+        Class<?> newClass = defineClass(className, classData, 0, classData.length);
         resolveClass(newClass);
         return newClass;
     }

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloaderTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloaderTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloaderTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ClassReloaderTestCase.java Fri Nov  8 21:08:30 2013
@@ -51,8 +51,8 @@ public class ClassReloaderTestCase exten
         ClassLoader sharedLoader = this.getClass().getClassLoader();
         ClassReloader componentLoader = new ClassReloader(sharedLoader);
 
-        Class sharedClass = DummyClass.class;
-        Class componentClass = componentLoader.reload(sharedClass);
+        Class<?> sharedClass = DummyClass.class;
+        Class<?> componentClass = componentLoader.reload(sharedClass);
 
         // the two Class objects contain the same bytecode, but are not equal
         assertTrue(sharedClass != componentClass);

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestBase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestBase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestBase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestBase.java Fri Nov  8 21:08:30 2013
@@ -25,8 +25,9 @@ import java.util.GregorianCalendar;
 import java.util.Locale;
 
 import junit.framework.TestCase;
-import org.apache.commons.beanutils.Converter;
+
 import org.apache.commons.beanutils.ConversionException;
+import org.apache.commons.beanutils.Converter;
 
 /**
  * Abstract base for &lt;Date&gt;Converter classes.
@@ -39,7 +40,7 @@ public abstract class DateConverterTestB
     // ------------------------------------------------------------------------
 
     /**
-     * Construtc a new test case.
+     * Construct a new test case.
      * @param name Name of the test
      */
     public DateConverterTestBase(String name) {
@@ -65,7 +66,7 @@ public abstract class DateConverterTestB
      * Return the expected type
      * @return The expected type
      */
-    protected abstract Class getExpectedType();
+    protected abstract Class<?> getExpectedType();
 
     /**
      * Convert from a Calendar to the appropriate Date type
@@ -152,7 +153,7 @@ public abstract class DateConverterTestB
     /**
      * Test default String to type conversion
      *
-     * N.B. This method is overriden by test case
+     * N.B. This method is overridden by test case
      * implementations for java.sql.Date/Time/Timestamp
      */
     public void testDefaultStringToTypeConvert() {
@@ -394,8 +395,8 @@ public abstract class DateConverterTestB
         String msg = "Converting '" + valueType + "' value '" + value + "'";
         try {
             Object result = converter.convert(getExpectedType(), value);
-            Class resultType = (result   == null ? null : result.getClass());
-            Class expectType = (expected == null ? null : expected.getClass());
+            Class<?> resultType = (result   == null ? null : result.getClass());
+            Class<?> expectType = (expected == null ? null : expected.getClass());
             assertEquals("TYPE "  + msg, expectType, resultType);
             assertEquals("VALUE " + msg, expected, result);
         } catch (Exception ex) {
@@ -414,8 +415,8 @@ public abstract class DateConverterTestB
         String msg = "Converting '" + valueType + "' value '" + value + "' to String";
         try {
             Object result = converter.convert(String.class, value);
-            Class resultType = (result   == null ? null : result.getClass());
-            Class expectType = (expected == null ? null : expected.getClass());
+            Class<?> resultType = (result   == null ? null : result.getClass());
+            Class<?> expectType = (expected == null ? null : expected.getClass());
             assertEquals("TYPE "  + msg, expectType, resultType);
             assertEquals("VALUE " + msg, expected, result);
         } catch (Exception ex) {

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DateConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -82,7 +82,7 @@ public class DateConverterTestCase exten
      * @return The expected type
      */
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Date.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DoubleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DoubleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DoubleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/DoubleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -71,7 +71,7 @@ public class DoubleConverterTestCase ext
     }
 
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Double.class;
     }
 
@@ -130,12 +130,12 @@ public class DoubleConverterTestCase ext
             assertEquals(
                 message[i] + " to Double",
                 expected[i].doubleValue(),
-                ((Double)(converter.convert(Double.class,input[i]))).doubleValue(),
+                (converter.convert(Double.class,input[i])).doubleValue(),
                 0.00001D);
             assertEquals(
                 message[i] + " to double",
                 expected[i].doubleValue(),
-                ((Double)(converter.convert(Double.TYPE,input[i]))).doubleValue(),
+                (converter.convert(Double.TYPE,input[i])).doubleValue(),
                 0.00001D);
             assertEquals(
                 message[i] + " to null type",

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FileConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FileConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FileConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FileConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -22,6 +22,7 @@ import java.io.File;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.commons.beanutils.ConversionException;
 import org.apache.commons.beanutils.Converter;
 
 
@@ -63,7 +64,7 @@ public class FileConverterTestCase exten
         return new FileConverter();
     }
 
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return File.class;
     }
 
@@ -94,5 +95,16 @@ public class FileConverterTestCase exten
         }
     }
 
+    /**
+     * Tries a conversion to an unsupported target type.
+     */
+    public void testUnsupportedTargetType() {
+        try {
+            converter.convert(Integer.class, "/tmp");
+            fail("Could convert to unsupported type!");
+        } catch (ConversionException cex) {
+            // expected result
+        }
+    }
 }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FloatConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FloatConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FloatConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/FloatConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -71,7 +71,7 @@ public class FloatConverterTestCase exte
     }
 
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Float.class;
     }
 
@@ -130,12 +130,12 @@ public class FloatConverterTestCase exte
             assertEquals(
                 message[i] + " to Float",
                 expected[i].floatValue(),
-                ((Float)(converter.convert(Float.class,input[i]))).floatValue(),
+                (converter.convert(Float.class,input[i])).floatValue(),
                 0.00001);
             assertEquals(
                 message[i] + " to float",
                 expected[i].floatValue(),
-                ((Float)(converter.convert(Float.TYPE,input[i]))).floatValue(),
+                (converter.convert(Float.TYPE,input[i])).floatValue(),
                 0.00001);
             assertEquals(
                 message[i] + " to null type",
@@ -151,7 +151,7 @@ public class FloatConverterTestCase exte
      */
     public void testInvalidAmount() {
         Converter converter = makeConverter();
-        Class clazz = Float.class;
+        Class<?> clazz = Float.class;
 
         Double max     = new Double(Float.MAX_VALUE);
         Double tooBig  = new Double(Double.MAX_VALUE);

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/IntegerConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/IntegerConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/IntegerConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/IntegerConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -19,6 +19,7 @@ package org.apache.commons.beanutils.con
 
 import junit.framework.TestSuite;
 
+import org.apache.commons.beanutils.ConversionException;
 import org.apache.commons.beanutils.Converter;
 
 
@@ -71,7 +72,7 @@ public class IntegerConverterTestCase ex
     }
 
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Integer.class;
     }
 
@@ -138,7 +139,7 @@ public class IntegerConverterTestCase ex
      */
     public void testInvalidAmount() {
         Converter converter = makeConverter();
-        Class clazz = Integer.class;
+        Class<?> clazz = Integer.class;
 
         Long min         = new Long(Integer.MIN_VALUE);
         Long max         = new Long(Integer.MAX_VALUE);
@@ -167,5 +168,18 @@ public class IntegerConverterTestCase ex
             // expected result
         }
     }
+
+    /**
+     * Tests whether an invalid default object causes an exception.
+     */
+    public void testInvalidDefaultObject() {
+        NumberConverter converter = makeConverter();
+        try {
+            converter.setDefaultValue("notANumber");
+            fail("Invalid default value not detected!");
+        } catch (ConversionException cex) {
+            // expected result
+        }
+    }
 }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/LongConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/LongConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/LongConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/LongConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -71,7 +71,7 @@ public class LongConverterTestCase exten
     }
 
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Long.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/MemoryTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/MemoryTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/MemoryTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/MemoryTestCase.java Fri Nov  8 21:08:30 2013
@@ -19,10 +19,11 @@ package org.apache.commons.beanutils.con
 
 import java.lang.ref.WeakReference;
 
-import org.apache.commons.beanutils.Converter;
-import org.apache.commons.beanutils.ConvertUtils;
 import junit.framework.TestCase;
 
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.Converter;
+
 /**
  * This class provides a number of unit tests related to classloaders and
  * garbage collection, particularly in j2ee-like situations.
@@ -39,7 +40,7 @@ public class MemoryTestCase extends Test
         Thread.currentThread().setContextClassLoader(componentLoader);
         Thread.currentThread().setContextClassLoader(origContextClassLoader);
 
-        WeakReference ref = new WeakReference(componentLoader);
+        WeakReference<ClassLoader> ref = new WeakReference<ClassLoader>(componentLoader);
         componentLoader = null;
 
         forceGarbageCollection(ref);
@@ -124,7 +125,7 @@ public class MemoryTestCase extends Test
 
             // Emulate a container "undeploying" component #1. This should
             // make component loader available for garbage collection (we hope)
-            WeakReference weakRefToComponent1 = new WeakReference(componentLoader1);
+            WeakReference<ClassLoader> weakRefToComponent1 = new WeakReference<ClassLoader>(componentLoader1);
             componentLoader1 = null;
 
             // force garbage collection and  verify that the componentLoader
@@ -179,7 +180,7 @@ public class MemoryTestCase extends Test
               // Here we pretend we're running inside the component, and that
               // a class FloatConverter has been loaded from the component's
               // private classpath.
-              Class newFloatConverterClass = componentLoader.reload(FloatConverter.class);
+              Class<?> newFloatConverterClass = componentLoader.reload(FloatConverter.class);
               Object newFloatConverter = newFloatConverterClass.newInstance();
               assertTrue(newFloatConverter.getClass().getClassLoader() == componentLoader);
 
@@ -218,7 +219,7 @@ public class MemoryTestCase extends Test
             Thread.currentThread().setContextClassLoader(origContextClassLoader);
             // Emulate a container "undeploying" the component. This should
             // make component loader available for garbage collection (we hope)
-            WeakReference weakRefToComponent = new WeakReference(componentLoader);
+            WeakReference<ClassLoader> weakRefToComponent = new WeakReference<ClassLoader>(componentLoader);
             componentLoader = null;
 
             // force garbage collection and  verify that the componentLoader
@@ -254,7 +255,7 @@ public class MemoryTestCase extends Test
      * else we were not able to trigger garbage collection; there is no way
      * to tell these scenarios apart.</p>
      */
-    private void forceGarbageCollection(WeakReference target) {
+    private void forceGarbageCollection(WeakReference<?> target) {
         int bytes = 2;
 
         while(target.get() != null) {
@@ -266,7 +267,8 @@ public class MemoryTestCase extends Test
             // all data (including the target) rather than simply collecting
             // this easily-reclaimable memory!
             try {
-                byte[] b =  new byte[bytes];
+                @SuppressWarnings("unused")
+                byte[] b = new byte[bytes];
                 bytes = bytes * 2;
             } catch(OutOfMemoryError e) {
                 // well that sure should have forced a garbage collection

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/NumberConverterTestBase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/NumberConverterTestBase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/NumberConverterTestBase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/NumberConverterTestBase.java Fri Nov  8 21:08:30 2013
@@ -49,7 +49,7 @@ public abstract class NumberConverterTes
 
     protected abstract NumberConverter makeConverter();
     protected abstract NumberConverter makeConverter(Object defaultValue);
-    protected abstract Class getExpectedType();
+    protected abstract Class<?> getExpectedType();
 
     // ------------------------------------------------------------------------
 
@@ -289,6 +289,17 @@ public abstract class NumberConverterTes
     }
 
     /**
+     * Convert String --> Number if the target type is not defined. Then the
+     * default type should be used.
+     */
+    public void testStringToNumberDefaultType() {
+        NumberConverter converter = makeConverter();
+        converter.setUseLocaleFormat(false);
+
+        assertEquals("Default Convert " + numbers[0], numbers[0], converter.convert(null, numbers[0].toString()));
+    }
+
+    /**
      * Convert Boolean --> Number (default conversion)
      */
     public void testBooleanToNumberDefault() {
@@ -407,5 +418,21 @@ public abstract class NumberConverterTes
             // expected result
         }
     }
+
+    /**
+     * Tests a conversion to an unsupported type if a default value is set.
+     */
+    public void testInvalidTypeWithDefault() {
+
+        NumberConverter converter = makeConverter(42);
+
+        try {
+            converter.convert(Object.class, numbers[0]);
+            fail("Invalid type with default test, expected ConversionException");
+        } catch(ConversionException e) {
+            // expected result
+        }
+    }
+
 }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ShortConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ShortConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ShortConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/ShortConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -71,7 +71,7 @@ public class ShortConverterTestCase exte
     }
 
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Short.class;
     }
 
@@ -138,7 +138,7 @@ public class ShortConverterTestCase exte
      */
     public void testInvalidAmount() {
         Converter converter = makeConverter();
-        Class clazz = Short.class;
+        Class<?> clazz = Short.class;
 
         Long min         = new Long(Short.MIN_VALUE);
         Long max         = new Long(Short.MAX_VALUE);

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlDateConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlDateConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlDateConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlDateConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -111,7 +111,7 @@ public class SqlDateConverterTestCase ex
      * @return The expected type
      */
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Date.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimeConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimeConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimeConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimeConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -134,7 +134,7 @@ public class SqlTimeConverterTestCase ex
      * @return The expected type
      */
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Time.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimestampConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimestampConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimestampConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/SqlTimestampConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -131,7 +131,7 @@ public class SqlTimestampConverterTestCa
      * @return The expected type
      */
     @Override
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return Timestamp.class;
     }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/URLConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/URLConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/URLConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/converters/URLConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -17,13 +17,14 @@
 
 package org.apache.commons.beanutils.converters;
 
-import junit.framework.TestSuite;
+import java.net.URL;
+
 import junit.framework.TestCase;
+import junit.framework.TestSuite;
 
+import org.apache.commons.beanutils.ConversionException;
 import org.apache.commons.beanutils.Converter;
 
-import java.net.URL;
-
 
 /**
  * Test Case for the URLConverter class.
@@ -63,7 +64,7 @@ public class URLConverterTestCase extend
         return new URLConverter();
     }
 
-    protected Class getExpectedType() {
+    protected Class<?> getExpectedType() {
         return URL.class;
     }
 
@@ -113,5 +114,16 @@ public class URLConverterTestCase extend
         }
     }
 
+    /**
+     * Tests a conversion to an unsupported type.
+     */
+    public void testUnsupportedType() {
+        try {
+            converter.convert(Integer.class, "http://www.apache.org");
+            fail("Unsupported type could be converted!");
+        } catch (ConversionException cex) {
+            // expected result
+        }
+    }
 }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleBeanificationTestCase.java Fri Nov  8 21:08:30 2013
@@ -17,24 +17,23 @@
 
 package org.apache.commons.beanutils.locale;
 
-import java.lang.ref.WeakReference;
 import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
 import java.util.Locale;
 import java.util.Map;
 import java.util.WeakHashMap;
 
-import junit.framework.TestCase;
 import junit.framework.Test;
+import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.commons.logging.LogFactory;
-
 import org.apache.commons.beanutils.BeanUtilsTestCase;
 import org.apache.commons.beanutils.ContextClassLoaderLocal;
-import org.apache.commons.beanutils.PrimitiveBean;
-import org.apache.commons.beanutils.ConvertUtils;
 import org.apache.commons.beanutils.ConversionException;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.PrimitiveBean;
 import org.apache.commons.beanutils.locale.converters.LongLocaleConverter;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * <p>
@@ -144,11 +143,11 @@ public class LocaleBeanificationTestCase
 
         // many thanks to Juozas Baliuka for suggesting this methodology
         TestClassLoader loader = new TestClassLoader();
-        ReferenceQueue<?> queue = new ReferenceQueue<Object>();
-        WeakReference loaderReference = new WeakReference(loader, queue);
+        ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
+        WeakReference<ClassLoader> loaderReference = new WeakReference<ClassLoader>(loader, queue);
         Integer test = new Integer(1);
 
-        WeakReference testReference = new WeakReference(test, queue);
+        WeakReference<Integer> testReference = new WeakReference<Integer>(test, queue);
         //Map map = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD, true);
         Map<TestClassLoader, Integer> map = new WeakHashMap<TestClassLoader, Integer>();
         map.put(loader, test);
@@ -224,8 +223,8 @@ public class LocaleBeanificationTestCase
         thread.start();
         thread.join();
 
-        WeakReference beanUtilsReference = new WeakReference(thread.beanUtils);
-        WeakReference convertUtilsReference = new WeakReference(thread.convertUtils);
+        WeakReference<LocaleBeanUtilsBean> beanUtilsReference = new WeakReference<LocaleBeanUtilsBean>(thread.beanUtils);
+        WeakReference<LocaleConvertUtilsBean> convertUtilsReference = new WeakReference<LocaleConvertUtilsBean>(thread.convertUtils);
 
         assertNotNull("Weak reference released early (1)", loaderReference.get());
         assertNotNull("Weak reference released early (2)", beanUtilsReference.get());
@@ -314,9 +313,9 @@ public class LocaleBeanificationTestCase
         class CCLLTesterThread extends Thread {
 
             private final Signal signal;
-            private final ContextClassLoaderLocal ccll;
+            private final ContextClassLoaderLocal<Integer> ccll;
 
-            CCLLTesterThread(Signal signal, ContextClassLoaderLocal ccll) {
+            CCLLTesterThread(Signal signal, ContextClassLoaderLocal<Integer> ccll) {
                 this.signal = signal;
                 this.ccll = ccll;
             }
@@ -334,8 +333,8 @@ public class LocaleBeanificationTestCase
             }
         }
 
-        ContextClassLoaderLocal ccll = new ContextClassLoaderLocal();
-        ccll.set(new Integer(1776));
+        ContextClassLoaderLocal<Integer> ccll = new ContextClassLoaderLocal<Integer>();
+        ccll.set(1776);
         assertEquals("Start thread sets value", new Integer(1776), ccll.get());
 
         Signal signal = new Signal();
@@ -369,11 +368,11 @@ public class LocaleBeanificationTestCase
                 try {
                     signal.setSignal(3);
                     LocaleConvertUtils.register(new LocaleConverter() {
-                                            public Object convert(Class type, Object value) {
-                                                return new Integer(9);
+                                            public <T> T convert(Class<T> type, Object value) {
+                                                return ConvertUtils.primitiveToWrapper(type).cast(9);
                                             }
-                                            public Object convert(Class type, Object value, String pattern) {
-                                                return new Integer(9);
+                                            public <T> T convert(Class<T> type, Object value, String pattern) {
+                                                return ConvertUtils.primitiveToWrapper(type).cast(9);
                                             }
                                                 }, Integer.TYPE, Locale.getDefault());
                     LocaleBeanUtils.setProperty(bean, "int", "1");
@@ -394,11 +393,11 @@ public class LocaleBeanificationTestCase
         assertEquals("Wrong property value (1)", 1, bean.getInt());
 
         LocaleConvertUtils.register(new LocaleConverter() {
-                                public Object convert(Class type, Object value) {
-                                    return new Integer(5);
+                                public <T> T convert(Class<T> type, Object value) {
+                                    return ConvertUtils.primitiveToWrapper(type).cast(5);
                                 }
-                                public Object convert(Class type, Object value, String pattern) {
-                                    return new Integer(5);
+                                public <T> T convert(Class<T> type, Object value, String pattern) {
+                                    return ConvertUtils.primitiveToWrapper(type).cast(5);
                                 }
                                     }, Integer.TYPE, Locale.getDefault());
         LocaleBeanUtils.setProperty(bean, "int", "1");
@@ -467,7 +466,7 @@ public class LocaleBeanificationTestCase
     /** Tests whether the unset method works*/
     public void testContextClassLoaderUnset() throws Exception {
         LocaleBeanUtilsBean beanOne = new LocaleBeanUtilsBean();
-        ContextClassLoaderLocal ccll = new ContextClassLoaderLocal();
+        ContextClassLoaderLocal<LocaleBeanUtilsBean> ccll = new ContextClassLoaderLocal<LocaleBeanUtilsBean>();
         ccll.set(beanOne);
         assertEquals("Start thread gets right instance", beanOne, ccll.get());
         ccll.unset();

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleConvertUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleConvertUtilsTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleConvertUtilsTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/LocaleConvertUtilsTestCase.java Fri Nov  8 21:08:30 2013
@@ -25,9 +25,10 @@ import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.util.Locale;
 
-import junit.framework.TestCase;
 import junit.framework.Test;
+import junit.framework.TestCase;
 import junit.framework.TestSuite;
+
 import org.apache.commons.beanutils.ConversionException;
 
 
@@ -134,8 +135,6 @@ public class LocaleConvertUtilsTestCase 
      */
     public void testNegativeScalar() {
 
-        Object value = null;
-
         /*  fixme Boolean converters not implemented at this point
         value = LocaleConvertUtils.convert("foo", Boolean.TYPE);
         ...
@@ -146,14 +145,14 @@ public class LocaleConvertUtilsTestCase 
 
 
         try {
-            value = LocaleConvertUtils.convert("foo", Byte.TYPE);
+            LocaleConvertUtils.convert("foo", Byte.TYPE);
             fail("Should have thrown conversion exception (1)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Byte.class);
+            LocaleConvertUtils.convert("foo", Byte.class);
             fail("Should have thrown conversion exception (2)");
         } catch (ConversionException e) {
             // Expected result
@@ -169,70 +168,70 @@ public class LocaleConvertUtilsTestCase 
          */
 
         try {
-            value = LocaleConvertUtils.convert("foo", Double.TYPE);
+            LocaleConvertUtils.convert("foo", Double.TYPE);
             fail("Should have thrown conversion exception (3)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Double.class);
+            LocaleConvertUtils.convert("foo", Double.class);
             fail("Should have thrown conversion exception (4)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Float.TYPE);
+            LocaleConvertUtils.convert("foo", Float.TYPE);
             fail("Should have thrown conversion exception (5)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Float.class);
+            LocaleConvertUtils.convert("foo", Float.class);
             fail("Should have thrown conversion exception (6)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Integer.TYPE);
+            LocaleConvertUtils.convert("foo", Integer.TYPE);
             fail("Should have thrown conversion exception (7)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Integer.class);
+            LocaleConvertUtils.convert("foo", Integer.class);
             fail("Should have thrown conversion exception (8)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Byte.TYPE);
+            LocaleConvertUtils.convert("foo", Byte.TYPE);
             fail("Should have thrown conversion exception (9)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Long.class);
+            LocaleConvertUtils.convert("foo", Long.class);
             fail("Should have thrown conversion exception (10)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Short.TYPE);
+            LocaleConvertUtils.convert("foo", Short.TYPE);
             fail("Should have thrown conversion exception (11)");
         } catch (ConversionException e) {
             // Expected result
         }
 
         try {
-            value = LocaleConvertUtils.convert("foo", Short.class);
+            LocaleConvertUtils.convert("foo", Short.class);
             fail("Should have thrown conversion exception (12)");
         } catch (ConversionException e) {
             // Expected result
@@ -629,6 +628,17 @@ public class LocaleConvertUtilsTestCase 
         assertEquals("Integer Array Value", new Integer(123), ((Integer[])result)[0]);
     }
 
+    /**
+     * Tests a conversion if there is no suitable converter registered. In this
+     * case, the string converter is used, and the passed in target type is
+     * ignored. (This test is added to prevent a regression after the locale
+     * converters have been generified.)
+     */
+    public void testDefaultToStringConversionUnsupportedType() {
+        Integer value = 20131101;
+        assertEquals("Wrong result", value.toString(),
+                LocaleConvertUtils.convert(value.toString(), getClass()));
+    }
 
     // -------------------------------------------------------- Private Methods
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BaseLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BaseLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BaseLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BaseLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -17,8 +17,10 @@
 
 package org.apache.commons.beanutils.locale.converters;
 
-import junit.framework.TestCase;
 import java.util.Locale;
+
+import junit.framework.TestCase;
+
 import org.apache.commons.beanutils.locale.BaseLocaleConverter;
 
 /**
@@ -180,16 +182,16 @@ public class BaseLocaleConverterTestCase
     }
 
     /**
-     * Test Converting Value To a spcified Type
+     * Test Converting Value To a specified Type
      */
-    protected void convertValueToType(BaseLocaleConverter converter, Class clazz, Object value, String pattern, Object expectedValue) {
+    protected void convertValueToType(BaseLocaleConverter converter, Class<?> clazz, Object value, String pattern, Object expectedValue) {
         convertValueToType(converter, "", clazz, value, pattern, expectedValue);
     }
 
     /**
-     * Test Converting Value To a spcified Type
+     * Test Converting Value To a specified Type
      */
-    protected void convertValueToType(BaseLocaleConverter converter, String msgId, Class clazz, Object value, String pattern, Object expectedValue) {
+    protected void convertValueToType(BaseLocaleConverter converter, String msgId, Class<?> clazz, Object value, String pattern, Object expectedValue) {
 
         // Convert value with no pattern
         try {

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigDecimalLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigDecimalLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigDecimalLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigDecimalLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -103,9 +103,9 @@ public class BigDecimalLocaleConverterTe
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a BigDecimal.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Double.class, localizedDecimalValue, localizedDecimalPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Double.class, localizedDecimalValue, localizedDecimalPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigIntegerLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigIntegerLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigIntegerLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/BigIntegerLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -19,6 +19,8 @@ package org.apache.commons.beanutils.loc
 
 import java.math.BigInteger;
 
+import org.apache.commons.beanutils.ConversionException;
+
 /**
  * Test Case for the BigIntegerLocaleConverter class.
  *
@@ -102,9 +104,9 @@ public class BigIntegerLocaleConverterTe
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a BigInteger.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------
@@ -259,7 +261,19 @@ public class BigIntegerLocaleConverterTe
 
     }
 
-
+    /**
+     * Tries to convert to an unsupported type. This tests behavior of the base
+     * class. All locale converters should react in the same way.
+     */
+    public void testUnsupportedType() {
+        converter = new BigIntegerLocaleConverter();
+        try {
+            converter.convert(getClass(), "test", null);
+            fail("Unsupported type not detected!");
+        } catch (ConversionException cex) {
+            // expected result
+        }
+    }
 
 }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ByteLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ByteLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ByteLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ByteLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -108,9 +108,9 @@ public class ByteLocaleConverterTestCase
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a Byte.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DateLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DateLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DateLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DateLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -17,15 +17,14 @@
 
 package org.apache.commons.beanutils.locale.converters;
 
-import java.text.SimpleDateFormat;
-import java.text.ParseException;
 import java.text.DateFormatSymbols;
-
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Locale;
 
 import org.apache.commons.beanutils.ConversionException;
-import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Test Case for the DateLocaleConverter class.
@@ -239,9 +238,9 @@ public class DateLocaleConverterTestCase
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a Date.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", String.class, localizedDateValue, localizedDatePattern, expectedValue);
+        //convertValueToType(converter, "(B)", String.class, localizedDateValue, localizedDatePattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DoubleLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DoubleLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DoubleLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/DoubleLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -102,9 +102,9 @@ public class DoubleLocaleConverterTestCa
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a Double.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Integer.class, localizedDecimalValue, localizedDecimalPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Integer.class, localizedDecimalValue, localizedDecimalPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -107,9 +107,9 @@ public class FloatLocaleConverterTestCas
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Float.class here it still returns a Float.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Integer.class, localizedDecimalValue, localizedDecimalPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Integer.class, localizedDecimalValue, localizedDecimalPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/IntegerLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/IntegerLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/IntegerLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/IntegerLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -101,9 +101,9 @@ public class IntegerLocaleConverterTestC
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a Integer.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------
@@ -272,6 +272,15 @@ public class IntegerLocaleConverterTestC
         assertEquals("Convert Long",    value, converter.convert(new Long(value.intValue())));
     }
 
-
+    /**
+     * Tests whether a conversion to a primitive type can be performed.
+     */
+    public void testToPrimitiveType() {
+        converter = new IntegerLocaleConverter();
+        Integer value = 20131028;
+        Class<Integer> target = Integer.TYPE;
+        int result = converter.convert(target, (Object) value.toString());
+        assertEquals("Wrong result", value.intValue(), result);
+    }
 }
 

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/LongLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/LongLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/LongLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/LongLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -101,9 +101,9 @@ public class LongLocaleConverterTestCase
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a Long.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------

Modified: commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ShortLocaleConverterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ShortLocaleConverterTestCase.java?rev=1540186&r1=1540185&r2=1540186&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ShortLocaleConverterTestCase.java (original)
+++ commons/proper/beanutils/trunk/src/test/java/org/apache/commons/beanutils/locale/converters/ShortLocaleConverterTestCase.java Fri Nov  8 21:08:30 2013
@@ -101,9 +101,9 @@ public class ShortLocaleConverterTestCas
         //
         // BaseLocaleConverter completely ignores the type - so even if we specify
         // Double.class here it still returns a Short.
-        //  **** SHOULD IMPLEMENT THIS BEHAVIOUR ****
+        //  **** This has been changed due to BEANUTILS-449 ****
         // **************************************************************************
-        convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
+        //convertValueToType(converter, "(B)", Double.class, localizedIntegerValue, localizedIntegerPattern, expectedValue);
 
 
         // ------------- Construct with non-localized pattern ------------



Mime
View raw message