You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/07/20 18:14:34 UTC

svn commit: r795895 - /commons/proper/lang/trunk/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java

Author: bayard
Date: Mon Jul 20 16:14:34 2009
New Revision: 795895

URL: http://svn.apache.org/viewvc?rev=795895&view=rev
Log:
Improving code coverage by testing exceptions and empty constructor

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

Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java?rev=795895&r1=795894&r2=795895&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/math/IEEE754rUtilsTest.java Mon Jul 20 16:14:34 2009
@@ -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();
+    }
     
 }