commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r758051 - in /commons/proper/math/trunk/src/test/org/apache/commons/math: ArgumentOutsideDomainExceptionTest.java FunctionEvaluationExceptionTest.java
Date Tue, 24 Mar 2009 22:10:16 GMT
Author: luc
Date: Tue Mar 24 22:10:16 2009
New Revision: 758051

URL: http://svn.apache.org/viewvc?rev=758051&view=rev
Log:
removed spurious exception in optimization

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

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java?rev=758051&r1=758050&r2=758051&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java
Tue Mar 24 22:10:16 2009
@@ -31,7 +31,7 @@
         assertNull(ex.getCause());
         assertNotNull(ex.getMessage());
         assertTrue(ex.getMessage().indexOf("3.14") > 0);
-        assertEquals(Math.PI, ex.getArgument(), 0);
+        assertEquals(Math.PI, ex.getArgument()[0], 0);
         assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
     }
     

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=758051&r1=758050&r2=758051&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
Tue Mar 24 22:10:16 2009
@@ -31,11 +31,22 @@
         assertNull(ex.getCause());
         assertNotNull(ex.getMessage());
         assertTrue(ex.getMessage().indexOf("0") > 0);
-        assertEquals(0.0, ex.getArgument(), 0);
+        assertEquals(0.0, ex.getArgument()[0], 0);
+    }
+    
+    public void testConstructorArray(){
+        FunctionEvaluationException ex =
+            new FunctionEvaluationException(new double[] { 0, 1, 2 });
+        assertNull(ex.getCause());
+        assertNotNull(ex.getMessage());
+        assertTrue(ex.getMessage().indexOf("0") > 0);
+        assertEquals(0.0, ex.getArgument()[0], 0);
+        assertEquals(1.0, ex.getArgument()[1], 0);
+        assertEquals(2.0, ex.getArgument()[2], 0);
     }
     
     public void testConstructorPatternArguments(){
-        String pattern = "Evaluation failed for argument = {0}";
+        String pattern = "evaluation failed for argument = {0}";
         Object[] arguments = { Double.valueOf(0.0) };
         FunctionEvaluationException ex = new FunctionEvaluationException(0.0, pattern, arguments);
         assertNull(ex.getCause());
@@ -48,8 +59,26 @@
         assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
     }
 
+    public void testConstructorArrayPatternArguments(){
+        String pattern = "evaluation failed for argument = {0}";
+        Object[] arguments = { Double.valueOf(0.0) };
+        FunctionEvaluationException ex =
+            new FunctionEvaluationException(new double[] { 0, 1, 2 }, pattern, arguments);
+        assertNull(ex.getCause());
+        assertEquals(pattern, ex.getPattern());
+        assertEquals(arguments.length, ex.getArguments().length);
+        for (int i = 0; i < arguments.length; ++i) {
+            assertEquals(arguments[i], ex.getArguments()[i]);
+        }
+        assertFalse(pattern.equals(ex.getMessage()));
+        assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
+        assertEquals(0.0, ex.getArgument()[0], 0);
+        assertEquals(1.0, ex.getArgument()[1], 0);
+        assertEquals(2.0, ex.getArgument()[2], 0);
+    }
+
     public void testConstructorPatternArgumentsCause(){
-        String pattern = "Evaluation failed for argument = {0}";
+        String pattern = "evaluation failed for argument = {0}";
         Object[] arguments = { Double.valueOf(0.0) };
         String inMsg = "inner message";
         Exception cause = new Exception(inMsg);
@@ -64,6 +93,26 @@
         assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
     }
 
+    public void testConstructorArrayPatternArgumentsCause(){
+        String pattern = "evaluation failed for argument = {0}";
+        Object[] arguments = { Double.valueOf(0.0) };
+        String inMsg = "inner message";
+        Exception cause = new Exception(inMsg);
+        FunctionEvaluationException ex =
+            new FunctionEvaluationException(cause, new double[] { 0, 1, 2 }, pattern, arguments);
+        assertEquals(cause, ex.getCause());
+        assertEquals(pattern, ex.getPattern());
+        assertEquals(arguments.length, ex.getArguments().length);
+        for (int i = 0; i < arguments.length; ++i) {
+            assertEquals(arguments[i], ex.getArguments()[i]);
+        }
+        assertFalse(pattern.equals(ex.getMessage()));
+        assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
+        assertEquals(0.0, ex.getArgument()[0], 0);
+        assertEquals(1.0, ex.getArgument()[1], 0);
+        assertEquals(2.0, ex.getArgument()[2], 0);
+    }
+
     public void testConstructorArgumentCause(){
         String inMsg = "inner message";
         Exception cause = new Exception(inMsg);
@@ -72,4 +121,16 @@
         assertTrue(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
     }
 
+    public void testConstructorArrayArgumentCause(){
+        String inMsg = "inner message";
+        Exception cause = new Exception(inMsg);
+        FunctionEvaluationException ex =
+            new FunctionEvaluationException(cause, new double[] { 0, 1, 2 });
+        assertEquals(cause, ex.getCause());
+        assertTrue(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
+        assertEquals(0.0, ex.getArgument()[0], 0);
+        assertEquals(1.0, ex.getArgument()[1], 0);
+        assertEquals(2.0, ex.getArgument()[2], 0);
+    }
+
 }



Mime
View raw message