Author: niallp
Date: Mon Feb  1 10:55:38 2010
New Revision: 905246

URL: http://svn.apache.org/viewvc?rev=905246&view=rev
Log:
Port r795895 to 2.x branch - Improve code coverage by testing exceptions and 
empty constructor

Modified:
    
commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/math/IEEE754rUtilsTest.java

Modified: 
commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/math/IEEE754rUtilsTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/math/IEEE754rUtilsTest.java?rev=905246&r1=905245&r2=905246&view=diff
==============================================================================
--- 
commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/math/IEEE754rUtilsTest.java
 (original)
+++ 
commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/math/IEEE754rUtilsTest.java
 Mon Feb  1 10:55:38 2010
@@ -49,5 +49,52 @@
         assertEquals(1.2f, IEEE754rUtils.min(bF), 0.01);
         assertEquals(42.0f, IEEE754rUtils.max(bF), 0.01);
     }
+
+    public void testEnforceExceptions() {
+        try {
+            IEEE754rUtils.min( (float[]) null);
+            fail("IllegalArgumentException expected for null input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+        try {
+            IEEE754rUtils.min(new float[0]);
+            fail("IllegalArgumentException expected for empty input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+        try {
+            IEEE754rUtils.max( (float[]) null);
+            fail("IllegalArgumentException expected for null input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+        try {
+            IEEE754rUtils.max(new float[0]);
+            fail("IllegalArgumentException expected for empty input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+        try {
+            IEEE754rUtils.min( (double[]) null);
+            fail("IllegalArgumentException expected for null input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+        try {
+            IEEE754rUtils.min(new double[0]);
+            fail("IllegalArgumentException expected for empty input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+        try {
+            IEEE754rUtils.max( (double[]) null);
+            fail("IllegalArgumentException expected for null input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+        try {
+            IEEE754rUtils.max(new double[0]);
+            fail("IllegalArgumentException expected for empty input");
+        } catch(IllegalArgumentException iae) { /* expected */ }
+
+    }
+
+    public void testConstructorExists() {
+        new IEEE754rUtils();
+    }
     
 }


Reply via email to