You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2010/10/01 16:08:29 UTC

svn commit: r1003543 - in /commons/proper/math/trunk/src/test/java/org/apache/commons/math: analysis/solvers/ fraction/ geometry/ linear/ ode/ stat/descriptive/

Author: sebb
Date: Fri Oct  1 14:08:28 2010
New Revision: 1003543

URL: http://svn.apache.org/viewvc?rev=1003543&view=rev
Log:
Add missing fail() calls for expected exceptions

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/RotationTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUDecompositionImplTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/MatrixUtilsTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java Fri Oct  1 14:08:28 2010
@@ -43,11 +43,13 @@ public class UnivariateRealSolverUtilsTe
     public void testSolveBadParameters() throws MathException {
         try { // bad endpoints
             UnivariateRealSolverUtils.solve(sin,0.0, 4.0, 4.0);
+            fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
         try { // bad accuracy
             UnivariateRealSolverUtils.solve(sin, 0.0, 4.0, 0.0);
+            fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java Fri Oct  1 14:08:28 2010
@@ -66,21 +66,25 @@ public class BigFractionTest extends Tes
         assertFraction(1055531162664967l, 70368744177664l, new BigFraction(15.0000000000001));
         try {
             new BigFraction(null, BigInteger.ONE);
+            fail("Expecting NullArgumentException");
         } catch (NullArgumentException npe) {
             // expected
         }
         try {
             new BigFraction(BigInteger.ONE, null);
+            fail("Expecting NullArgumentException");
         } catch (NullArgumentException npe) {
             // expected
         }
         try {
             new BigFraction(BigInteger.ONE, BigInteger.ZERO);
+            fail("Expecting ArithmeticException");
         } catch (ArithmeticException npe) {
             // expected
         }
         try {
             new BigFraction(2.0 * Integer.MAX_VALUE, 1.0e-5, 100000);
+            fail("Expecting FractionConversionException");
         } catch (FractionConversionException fce) {
             // expected
         }
@@ -232,7 +236,7 @@ public class BigFractionTest extends Tes
         for (double v : new double[] { Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY}) {
             try {
                 new BigFraction(v);
-                fail("expected exception");
+                fail("Expecting IllegalArgumentException");
             } catch (IllegalArgumentException iae) {
                 // expected
             }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/RotationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/RotationTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/RotationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/RotationTest.java Fri Oct  1 14:08:28 2010
@@ -164,6 +164,7 @@ public class RotationTest
                      { 0.0, 1.0, 0.0 },
                      { 1.0, 0.0, 0.0 }
                    }, 1.0e-7);
+      fail("Expecting NotARotationMatrixException");
     } catch (NotARotationMatrixException nrme) {
       // expected behavior
     } catch (Exception e) {
@@ -176,6 +177,7 @@ public class RotationTest
                      {  0.821760, -0.184320,  0.539200 },
                      { -0.354816,  0.574912,  0.737280 }
                    }, 1.0e-7);
+      fail("Expecting NotARotationMatrixException");
     } catch (NotARotationMatrixException nrme) {
       // expected behavior
     } catch (Exception e) {
@@ -188,6 +190,7 @@ public class RotationTest
                        { -0.4,  0.6,  0.7 },
                        {  0.8, -0.2,  0.5 }
                      }, 1.0e-15);
+        fail("Expecting NotARotationMatrixException");
       } catch (NotARotationMatrixException nrme) {
         // expected behavior
       } catch (Exception e) {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUDecompositionImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUDecompositionImplTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUDecompositionImplTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUDecompositionImplTest.java Fri Oct  1 14:08:28 2010
@@ -73,6 +73,7 @@ public class LUDecompositionImplTest ext
     public void testNonSquare() {
         try {
             new LUDecompositionImpl(MatrixUtils.createRealMatrix(new double[3][2]));
+            fail("Expecting InvalidMatrixException");
         } catch (InvalidMatrixException ime) {
             // expected behavior
         } catch (Exception e) {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/MatrixUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/MatrixUtilsTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/MatrixUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/MatrixUtilsTest.java Fri Oct  1 14:08:28 2010
@@ -285,6 +285,7 @@ public final class MatrixUtilsTest exten
         checkIdentityMatrix(MatrixUtils.createRealIdentityMatrix(1));
         try {
             MatrixUtils.createRealIdentityMatrix(0);
+            fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
@@ -311,6 +312,7 @@ public final class MatrixUtilsTest exten
         checkIdentityFieldMatrix(MatrixUtils.createFieldIdentityMatrix(FractionField.getInstance(), 1));
         try {
             MatrixUtils.createRealIdentityMatrix(0);
+            fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
@@ -392,6 +394,7 @@ public final class MatrixUtilsTest exten
         checkIdentityBigMatrix(MatrixUtils.createBigIdentityMatrix(1));
         try {
             MatrixUtils.createRealIdentityMatrix(0);
+            fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java Fri Oct  1 14:08:28 2010
@@ -333,6 +333,7 @@ public abstract class RealVectorFormatAb
     public void testParseNoComponents() {
         try {
             realVectorFormat.parseObject("{ }");
+            fail("Expecting ParseException");
         } catch (ParseException pe) {
             // expected behavior
         } catch (Exception e) {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java Fri Oct  1 14:08:28 2010
@@ -159,6 +159,7 @@ public class ContinuousOutputModelTest
           ContinuousOutputModel otherCm = new ContinuousOutputModel();
           otherCm.handleStep(buildInterpolator(t0, y0, t1), true);
           cm.append(otherCm);
+          fail("Expecting IllegalArgumentException");
       } catch(IllegalArgumentException iae) {
           //expected behavior
           return true;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java?rev=1003543&r1=1003542&r2=1003543&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java Fri Oct  1 14:08:28 2010
@@ -173,6 +173,7 @@ public class MultivariateSummaryStatisti
     public void testDimension() {
         try {
             createMultivariateSummaryStatistics(2, true).addValue(new double[3]);
+            fail("Expecting DimensionMismatchException");
         } catch (DimensionMismatchException dme) {
             // expected behavior
         } catch (Exception e) {