commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1620432 - /commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TransformerRegistryTestCase.java
Date Mon, 25 Aug 2014 20:52:32 GMT
Author: britter
Date: Mon Aug 25 20:52:32 2014
New Revision: 1620432

URL: http://svn.apache.org/r1620432
Log:
Test bad cases

Modified:
    commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TransformerRegistryTestCase.java

Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TransformerRegistryTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TransformerRegistryTestCase.java?rev=1620432&r1=1620431&r2=1620432&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TransformerRegistryTestCase.java
(original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TransformerRegistryTestCase.java
Mon Aug 25 20:52:32 2014
@@ -22,6 +22,7 @@ import static org.junit.Assert.fail;
 
 import java.lang.reflect.Type;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
@@ -63,6 +64,11 @@ public class TransformerRegistryTestCase
                 getClass(transformerStringIntegerImpl.getTargetType())));
     }
 
+    @Test(expected = NullPointerException.class)
+    public void testRegisterNull() throws Exception {
+        registry.register(null);
+    }
+
     /**
      * Tests for the registerAll() method in TransformerRegistry
      */
@@ -85,6 +91,16 @@ public class TransformerRegistryTestCase
                 getClass(transformerStringFloatImpl.getTargetType())));
     }
 
+    @Test(expected = NullPointerException.class)
+    public void testRegisterAllNull() throws Exception {
+        registry.registerAll(null);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testRegisterAllEmpty() throws Exception {
+        registry.registerAll(Collections.<Transformer<?, ?>> emptyList());
+    }
+
     /**
      * Tests for the lookup() method in TransformerRegistry
      */
@@ -95,6 +111,16 @@ public class TransformerRegistryTestCase
                 getClass(transformerStringIntegerImpl.getTargetType())));
     }
 
+    @Test(expected = NullPointerException.class)
+    public void testLookupTypeNull() throws Exception {
+        registry.lookup(String.class, null);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testLookupNullType() throws Exception {
+        registry.lookup(null, String.class);
+    }
+
     @Test(expected = TransformationException.class)
     public void testLookupThrowsExceptionIfNoTransformerFound() throws Exception {
         registry.lookup(Date.class, String.class);
@@ -116,6 +142,21 @@ public class TransformerRegistryTestCase
         }
     }
 
+    @Test(expected = NullPointerException.class)
+    public void testDeregisterNull() throws Exception {
+        registry.deregister(null);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testDeregisterTypeNull() throws Exception {
+        registry.deregister(String.class, null);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testDeregisterNullType() throws Exception {
+        registry.deregister(null, String.class);
+    }
+
     /**
      * Tests for the deregisterAll() method in TransformerRegistry
      */



Mime
View raw message