commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adri...@apache.org
Subject svn commit: r932839 - /commons/sandbox/convert/trunk/src/test/java/org/apache/commons/convert/TestMisc.java
Date Sun, 11 Apr 2010 05:47:13 GMT
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);
     }



Mime
View raw message