Author: adrianc
Date: Sun Apr 11 05:47:12 2010
New Revision: 932839

URL: http://svn.apache.org/viewvc?rev=932839&view=rev
Log:
More misc tests.

Modified:
    
commons/sandbox/convert/trunk/src/test/java/org/apache/commons/convert/TestMisc.java

Modified: 
commons/sandbox/convert/trunk/src/test/java/org/apache/commons/convert/TestMisc.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/test/java/org/apache/commons/convert/TestMisc.java?rev=932839&r1=932838&r2=932839&view=diff
==============================================================================
--- 
commons/sandbox/convert/trunk/src/test/java/org/apache/commons/convert/TestMisc.java
 (original)
+++ 
commons/sandbox/convert/trunk/src/test/java/org/apache/commons/convert/TestMisc.java
 Sun Apr 11 05:47:12 2010
@@ -56,6 +56,31 @@ public class TestMisc extends TestCase {
         constructors[0].newInstance();
     }
 
+    public void testConversionException() {
+        java.util.Date nullDate = null;
+        Converter<String, java.util.Date> converter = new 
DateTimeConverters.StringToDate();
+        try {
+            nullDate = converter.convert("");
+        } catch (ConversionException e) {
+            @SuppressWarnings("unused")
+            Exception ex = new ConversionException("Test case");
+            ex = new ConversionException("Test case", e);
+        }
+        assertEquals("ConversionException", null, nullDate);
+    }
+
+    public void testConverterFactory() {
+        Converter<BigDecimal, URL> notFound = null;
+        try {
+            notFound = Converters.getConverter(BigDecimal.class, URL.class);
+        } catch (ClassNotFoundException e) {}
+        assertEquals("Converter not found", null, notFound);
+        try {
+            notFound = Converters.getConverter(BigDecimal.class, URL.class);
+        } catch (ClassNotFoundException e) {}
+        assertEquals("Converter not found", null, notFound);
+    }
+
     public void testLoadContainedConvertersIgnoresException() {
         Converters.loadContainedConverters(TestMisc.class);
     }


Reply via email to