commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r592705 - in /commons/proper/math/trunk/src/test/org/apache/commons/math: FunctionEvaluationExceptionTest.java MaxIterationsExceededExceptionTest.java
Date Wed, 07 Nov 2007 11:10:23 GMT
Author: luc
Date: Wed Nov  7 03:10:22 2007
New Revision: 592705

URL: http://svn.apache.org/viewvc?rev=592705&view=rev
Log:
improved test coverage

Modified:
    commons/proper/math/trunk/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java?rev=592705&r1=592704&r2=592705&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/FunctionEvaluationExceptionTest.java
Wed Nov  7 03:10:22 2007
@@ -64,4 +64,12 @@
         assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
     }
 
+    public void testConstructorArgumentCause(){
+        String inMsg = "inner message";
+        Exception cause = new Exception(inMsg);
+        FunctionEvaluationException ex = new FunctionEvaluationException(0.0, cause);
+        assertEquals(cause, ex.getCause());
+        assertTrue(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
+    }
+
 }

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java?rev=592705&r1=592704&r2=592705&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/MaxIterationsExceededExceptionTest.java
Wed Nov  7 03:10:22 2007
@@ -26,11 +26,24 @@
  */
 public class MaxIterationsExceededExceptionTest extends TestCase {
     
-    public void testConstructor(){
+    public void testSimpleConstructor(){
         MaxIterationsExceededException ex = new MaxIterationsExceededException(1000000);
         assertNull(ex.getCause());
         assertNotNull(ex.getMessage());
         assertTrue(ex.getMessage().indexOf("1,000,000") > 0);
+        assertEquals(1000000, ex.getMaxIterations());
+        assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
+    }
+
+    public void testComplexConstructor(){
+        MaxIterationsExceededException ex =
+            new MaxIterationsExceededException(1000000,
+                "Continued fraction convergents failed to converge for value {0}",
+                new Object[] { new Double(1234567) });
+        assertNull(ex.getCause());
+        assertNotNull(ex.getMessage());
+        assertTrue(ex.getMessage().indexOf("1,000,000") < 0);
+        assertTrue(ex.getMessage().indexOf("1,234,567") > 0);
         assertEquals(1000000, ex.getMaxIterations());
         assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
     }



Mime
View raw message