commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1083514 [2/15] - in /commons/proper/math/trunk/src/test/java/org/apache/commons/math: ./ analysis/integration/ analysis/interpolation/ analysis/polynomials/ analysis/solvers/ complex/ distribution/ fraction/ genetics/ geometry/ linear/ ode...
Date Sun, 20 Mar 2011 17:24:19 GMT
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BrentSolverTest.java Sun Mar 20 17:24:14 2011
@@ -28,7 +28,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Testcase for {@link BrentSolver Brent} solver.
+ * Test case for {@link BrentSolver Brent} solver.
  * Because Brent-Dekker is guaranteed to converge in less than the default
  * maximum iteration count due to bisection fallback, it is quite hard to
  * debug. I include measured iteration counts plus one in order to detect

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/LaguerreSolverTest.java Sun Mar 20 17:24:14 2011
@@ -24,7 +24,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Testcase for Laguerre solver.
+ * Test case for Laguerre solver.
  * <p>
  * Laguerre's method is very efficient in solving polynomials. Test runs
  * show that for a default absolute accuracy of 1E-6, it generally takes

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolver2Test.java Sun Mar 20 17:24:14 2011
@@ -27,7 +27,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Testcase for {@link MullerSolver2 Muller} solver.
+ * Test case for {@link MullerSolver2 Muller} solver.
  * <p>
  * Muller's method converges almost quadratically near roots, but it can
  * be very slow in regions far away from zeros. Test runs show that for

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/MullerSolverTest.java Sun Mar 20 17:24:14 2011
@@ -27,7 +27,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Testcase for {@link MullerSolver Muller} solver.
+ * Test case for {@link MullerSolver Muller} solver.
  * <p>
  * Muller's method converges almost quadratically near roots, but it can
  * be very slow in regions far away from zeros. Test runs show that for

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/RiddersSolverTest.java Sun Mar 20 17:24:14 2011
@@ -27,7 +27,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Testcase for {@link RiddersSolver Ridders} solver.
+ * Test case for {@link RiddersSolver Ridders} solver.
  * <p>
  * Ridders' method converges superlinearly, more specific, its rate of
  * convergence is sqrt(2). Test runs show that for a default absolute

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/SecantSolverTest.java Sun Mar 20 17:24:14 2011
@@ -26,7 +26,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Testcase for {@link SecantSolver}.
+ * Test case for {@link SecantSolver}.
  *
  * @version $Revision:670469 $ $Date:2008-06-23 10:01:38 +0200 (lun., 23 juin 2008) $
  */

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFieldTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFieldTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexFieldTest.java Sun Mar 20 17:24:14 2011
@@ -16,29 +16,27 @@
  */
 package org.apache.commons.math.complex;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import org.apache.commons.math.TestUtils;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class ComplexFieldTest {
 
     @Test
     public void testZero() {
-        assertEquals(Complex.ZERO, ComplexField.getInstance().getZero());
+        Assert.assertEquals(Complex.ZERO, ComplexField.getInstance().getZero());
     }
 
     @Test
     public void testOne() {
-        assertEquals(Complex.ONE, ComplexField.getInstance().getOne());
+        Assert.assertEquals(Complex.ONE, ComplexField.getInstance().getOne());
     }
 
     @Test
     public void testSerial() {
         // deserializing the singleton should give the singleton itself back
         ComplexField field = ComplexField.getInstance();
-        assertTrue(field == TestUtils.serializeAndRecover(field));
+        Assert.assertTrue(field == TestUtils.serializeAndRecover(field));
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java Sun Mar 20 17:24:14 2011
@@ -19,15 +19,16 @@ package org.apache.commons.math.complex;
 
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.util.FastMath;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.List;
 
-import junit.framework.TestCase;
 
 /**
  * @version $Revision$ $Date$
  */
-public class ComplexTest extends TestCase {
+public class ComplexTest {
 
 
     private double inf = Double.POSITIVE_INFINITY;
@@ -53,297 +54,334 @@ public class ComplexTest extends TestCas
     private Complex nanNegInf = new Complex(nan, neginf);
     private Complex nanZero = new Complex(nan, 0);
 
+    @Test
     public void testConstructor() {
         Complex z = new Complex(3.0, 4.0);
-        assertEquals(3.0, z.getReal(), 1.0e-5);
-        assertEquals(4.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(3.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(4.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testConstructorNaN() {
         Complex z = new Complex(3.0, Double.NaN);
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
 
         z = new Complex(nan, 4.0);
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
 
         z = new Complex(3.0, 4.0);
-        assertFalse(z.isNaN());
+        Assert.assertFalse(z.isNaN());
     }
 
+    @Test
     public void testAbs() {
         Complex z = new Complex(3.0, 4.0);
-        assertEquals(5.0, z.abs(), 1.0e-5);
+        Assert.assertEquals(5.0, z.abs(), 1.0e-5);
     }
 
+    @Test
     public void testAbsNaN() {
-        assertTrue(Double.isNaN(Complex.NaN.abs()));
+        Assert.assertTrue(Double.isNaN(Complex.NaN.abs()));
         Complex z = new Complex(inf, nan);
-        assertTrue(Double.isNaN(z.abs()));
+        Assert.assertTrue(Double.isNaN(z.abs()));
     }
 
+    @Test
     public void testAbsInfinite() {
         Complex z = new Complex(inf, 0);
-        assertEquals(inf, z.abs(), 0);
+        Assert.assertEquals(inf, z.abs(), 0);
         z = new Complex(0, neginf);
-        assertEquals(inf, z.abs(), 0);
+        Assert.assertEquals(inf, z.abs(), 0);
         z = new Complex(inf, neginf);
-        assertEquals(inf, z.abs(), 0);
+        Assert.assertEquals(inf, z.abs(), 0);
     }
 
+    @Test
     public void testAdd() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
         Complex z = x.add(y);
-        assertEquals(8.0, z.getReal(), 1.0e-5);
-        assertEquals(10.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(8.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(10.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testAddNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.add(Complex.NaN);
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
         z = new Complex(1, nan);
         Complex w = x.add(z);
-        assertEquals(w.getReal(), 4.0, 0);
-        assertTrue(Double.isNaN(w.getImaginary()));
+        Assert.assertEquals(w.getReal(), 4.0, 0);
+        Assert.assertTrue(Double.isNaN(w.getImaginary()));
     }
 
+    @Test
     public void testAddInfinite() {
         Complex x = new Complex(1, 1);
         Complex z = new Complex(inf, 0);
         Complex w = x.add(z);
-        assertEquals(w.getImaginary(), 1, 0);
-        assertEquals(inf, w.getReal(), 0);
+        Assert.assertEquals(w.getImaginary(), 1, 0);
+        Assert.assertEquals(inf, w.getReal(), 0);
 
         x = new Complex(neginf, 0);
-        assertTrue(Double.isNaN(x.add(z).getReal()));
+        Assert.assertTrue(Double.isNaN(x.add(z).getReal()));
     }
 
+    @Test
     public void testConjugate() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.conjugate();
-        assertEquals(3.0, z.getReal(), 1.0e-5);
-        assertEquals(-4.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(3.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(-4.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testConjugateNaN() {
         Complex z = Complex.NaN.conjugate();
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
     }
 
+    @Test
     public void testConjugateInfiinite() {
         Complex z = new Complex(0, inf);
-        assertEquals(neginf, z.conjugate().getImaginary(), 0);
+        Assert.assertEquals(neginf, z.conjugate().getImaginary(), 0);
         z = new Complex(0, neginf);
-        assertEquals(inf, z.conjugate().getImaginary(), 0);
+        Assert.assertEquals(inf, z.conjugate().getImaginary(), 0);
     }
 
+    @Test
     public void testDivide() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
         Complex z = x.divide(y);
-        assertEquals(39.0 / 61.0, z.getReal(), 1.0e-5);
-        assertEquals(2.0 / 61.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(39.0 / 61.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(2.0 / 61.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testDivideReal() {
         Complex x = new Complex(2d, 3d);
         Complex y = new Complex(2d, 0d);
-        assertEquals(new Complex(1d, 1.5), x.divide(y));
+        Assert.assertEquals(new Complex(1d, 1.5), x.divide(y));
 
     }
 
+    @Test
     public void testDivideImaginary() {
         Complex x = new Complex(2d, 3d);
         Complex y = new Complex(0d, 2d);
-        assertEquals(new Complex(1.5d, -1d), x.divide(y));
+        Assert.assertEquals(new Complex(1.5d, -1d), x.divide(y));
     }
 
+    @Test
     public void testDivideInfinite() {
         Complex x = new Complex(3, 4);
         Complex w = new Complex(neginf, inf);
-        assertTrue(x.divide(w).equals(Complex.ZERO));
+        Assert.assertTrue(x.divide(w).equals(Complex.ZERO));
 
         Complex z = w.divide(x);
-        assertTrue(Double.isNaN(z.getReal()));
-        assertEquals(inf, z.getImaginary(), 0);
+        Assert.assertTrue(Double.isNaN(z.getReal()));
+        Assert.assertEquals(inf, z.getImaginary(), 0);
 
         w = new Complex(inf, inf);
         z = w.divide(x);
-        assertTrue(Double.isNaN(z.getImaginary()));
-        assertEquals(inf, z.getReal(), 0);
+        Assert.assertTrue(Double.isNaN(z.getImaginary()));
+        Assert.assertEquals(inf, z.getReal(), 0);
 
         w = new Complex(1, inf);
         z = w.divide(w);
-        assertTrue(Double.isNaN(z.getReal()));
-        assertTrue(Double.isNaN(z.getImaginary()));
+        Assert.assertTrue(Double.isNaN(z.getReal()));
+        Assert.assertTrue(Double.isNaN(z.getImaginary()));
     }
 
+    @Test
     public void testDivideZero() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.divide(Complex.ZERO);
-        assertEquals(z, Complex.NaN);
+        Assert.assertEquals(z, Complex.NaN);
     }
 
+    @Test
     public void testDivideNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.divide(Complex.NaN);
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
     }
 
+    @Test
     public void testDivideNaNInf() {
        Complex z = oneInf.divide(Complex.ONE);
-       assertTrue(Double.isNaN(z.getReal()));
-       assertEquals(inf, z.getImaginary(), 0);
+       Assert.assertTrue(Double.isNaN(z.getReal()));
+       Assert.assertEquals(inf, z.getImaginary(), 0);
 
        z = negInfNegInf.divide(oneNaN);
-       assertTrue(Double.isNaN(z.getReal()));
-       assertTrue(Double.isNaN(z.getImaginary()));
+       Assert.assertTrue(Double.isNaN(z.getReal()));
+       Assert.assertTrue(Double.isNaN(z.getImaginary()));
 
        z = negInfInf.divide(Complex.ONE);
-       assertTrue(Double.isNaN(z.getReal()));
-       assertTrue(Double.isNaN(z.getImaginary()));
+       Assert.assertTrue(Double.isNaN(z.getReal()));
+       Assert.assertTrue(Double.isNaN(z.getImaginary()));
     }
 
+    @Test
     public void testMultiply() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
         Complex z = x.multiply(y);
-        assertEquals(-9.0, z.getReal(), 1.0e-5);
-        assertEquals(38.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(-9.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(38.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testMultiplyNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.multiply(Complex.NaN);
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
     }
 
+    @Test
     public void testMultiplyNaNInf() {
         Complex z = new Complex(1,1);
         Complex w = z.multiply(infOne);
-        assertEquals(w.getReal(), inf, 0);
-        assertEquals(w.getImaginary(), inf, 0);
+        Assert.assertEquals(w.getReal(), inf, 0);
+        Assert.assertEquals(w.getImaginary(), inf, 0);
 
         // [MATH-164]
-        assertTrue(new Complex( 1,0).multiply(infInf).equals(Complex.INF));
-        assertTrue(new Complex(-1,0).multiply(infInf).equals(Complex.INF));
-        assertTrue(new Complex( 1,0).multiply(negInfZero).equals(Complex.INF));
+        Assert.assertTrue(new Complex( 1,0).multiply(infInf).equals(Complex.INF));
+        Assert.assertTrue(new Complex(-1,0).multiply(infInf).equals(Complex.INF));
+        Assert.assertTrue(new Complex( 1,0).multiply(negInfZero).equals(Complex.INF));
 
         w = oneInf.multiply(oneNegInf);
-        assertEquals(w.getReal(), inf, 0);
-        assertEquals(w.getImaginary(), inf, 0);
+        Assert.assertEquals(w.getReal(), inf, 0);
+        Assert.assertEquals(w.getImaginary(), inf, 0);
 
         w = negInfNegInf.multiply(oneNaN);
-        assertTrue(Double.isNaN(w.getReal()));
-        assertTrue(Double.isNaN(w.getImaginary()));
+        Assert.assertTrue(Double.isNaN(w.getReal()));
+        Assert.assertTrue(Double.isNaN(w.getImaginary()));
     }
 
+    @Test
     public void testScalarMultiply() {
         Complex x = new Complex(3.0, 4.0);
         double y = 2.0;
         Complex z = x.multiply(y);
-        assertEquals(6.0, z.getReal(), 1.0e-5);
-        assertEquals(8.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(6.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(8.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testScalarMultiplyNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.multiply(Double.NaN);
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
     }
 
+    @Test
     public void testScalarMultiplyInf() {
         Complex z = new Complex(1,1);
         Complex w = z.multiply(Double.POSITIVE_INFINITY);
-        assertEquals(w.getReal(), inf, 0);
-        assertEquals(w.getImaginary(), inf, 0);
+        Assert.assertEquals(w.getReal(), inf, 0);
+        Assert.assertEquals(w.getImaginary(), inf, 0);
 
         w = z.multiply(Double.NEGATIVE_INFINITY);
-        assertEquals(w.getReal(), inf, 0);
-        assertEquals(w.getImaginary(), inf, 0);
+        Assert.assertEquals(w.getReal(), inf, 0);
+        Assert.assertEquals(w.getImaginary(), inf, 0);
     }
 
+    @Test
     public void testNegate() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.negate();
-        assertEquals(-3.0, z.getReal(), 1.0e-5);
-        assertEquals(-4.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(-3.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(-4.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testNegateNaN() {
         Complex z = Complex.NaN.negate();
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
     }
 
+    @Test
     public void testSubtract() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(5.0, 6.0);
         Complex z = x.subtract(y);
-        assertEquals(-2.0, z.getReal(), 1.0e-5);
-        assertEquals(-2.0, z.getImaginary(), 1.0e-5);
+        Assert.assertEquals(-2.0, z.getReal(), 1.0e-5);
+        Assert.assertEquals(-2.0, z.getImaginary(), 1.0e-5);
     }
 
+    @Test
     public void testSubtractNaN() {
         Complex x = new Complex(3.0, 4.0);
         Complex z = x.subtract(Complex.NaN);
-        assertTrue(z.isNaN());
+        Assert.assertTrue(z.isNaN());
     }
 
+    @Test
     public void testEqualsNull() {
         Complex x = new Complex(3.0, 4.0);
-        assertFalse(x.equals(null));
+        Assert.assertFalse(x.equals(null));
     }
 
+    @Test
     public void testEqualsClass() {
         Complex x = new Complex(3.0, 4.0);
-        assertFalse(x.equals(this));
+        Assert.assertFalse(x.equals(this));
     }
 
+    @Test
     public void testEqualsSame() {
         Complex x = new Complex(3.0, 4.0);
-        assertTrue(x.equals(x));
+        Assert.assertTrue(x.equals(x));
     }
 
+    @Test
     public void testEqualsTrue() {
         Complex x = new Complex(3.0, 4.0);
         Complex y = new Complex(3.0, 4.0);
-        assertTrue(x.equals(y));
+        Assert.assertTrue(x.equals(y));
     }
 
+    @Test
     public void testEqualsRealDifference() {
         Complex x = new Complex(0.0, 0.0);
         Complex y = new Complex(0.0 + Double.MIN_VALUE, 0.0);
-        assertFalse(x.equals(y));
+        Assert.assertFalse(x.equals(y));
     }
 
+    @Test
     public void testEqualsImaginaryDifference() {
         Complex x = new Complex(0.0, 0.0);
         Complex y = new Complex(0.0, 0.0 + Double.MIN_VALUE);
-        assertFalse(x.equals(y));
+        Assert.assertFalse(x.equals(y));
     }
 
+    @Test
     public void testEqualsNaN() {
         Complex realNaN = new Complex(Double.NaN, 0.0);
         Complex imaginaryNaN = new Complex(0.0, Double.NaN);
         Complex complexNaN = Complex.NaN;
-        assertTrue(realNaN.equals(imaginaryNaN));
-        assertTrue(imaginaryNaN.equals(complexNaN));
-        assertTrue(realNaN.equals(complexNaN));
+        Assert.assertTrue(realNaN.equals(imaginaryNaN));
+        Assert.assertTrue(imaginaryNaN.equals(complexNaN));
+        Assert.assertTrue(realNaN.equals(complexNaN));
     }
 
+    @Test
     public void testHashCode() {
         Complex x = new Complex(0.0, 0.0);
         Complex y = new Complex(0.0, 0.0 + Double.MIN_VALUE);
-        assertFalse(x.hashCode()==y.hashCode());
+        Assert.assertFalse(x.hashCode()==y.hashCode());
         y = new Complex(0.0 + Double.MIN_VALUE, 0.0);
-        assertFalse(x.hashCode()==y.hashCode());
+        Assert.assertFalse(x.hashCode()==y.hashCode());
         Complex realNaN = new Complex(Double.NaN, 0.0);
         Complex imaginaryNaN = new Complex(0.0, Double.NaN);
-        assertEquals(realNaN.hashCode(), imaginaryNaN.hashCode());
-        assertEquals(imaginaryNaN.hashCode(), Complex.NaN.hashCode());
+        Assert.assertEquals(realNaN.hashCode(), imaginaryNaN.hashCode());
+        Assert.assertEquals(imaginaryNaN.hashCode(), Complex.NaN.hashCode());
     }
 
+    @Test
     public void testAcos() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(0.936812, -2.30551);
@@ -352,6 +390,7 @@ public class ComplexTest extends TestCas
                 Complex.ZERO.acos(), 1.0e-12);
     }
 
+    @Test
     public void testAcosInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.acos());
         TestUtils.assertSame(Complex.NaN, oneNegInf.acos());
@@ -363,20 +402,24 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.acos());
     }
 
+    @Test
     public void testAcosNaN() {
-        assertTrue(Complex.NaN.acos().isNaN());
+        Assert.assertTrue(Complex.NaN.acos().isNaN());
     }
 
+    @Test
     public void testAsin() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(0.633984, 2.30551);
         TestUtils.assertEquals(expected, z.asin(), 1.0e-5);
     }
 
+    @Test
     public void testAsinNaN() {
-        assertTrue(Complex.NaN.asin().isNaN());
+        Assert.assertTrue(Complex.NaN.asin().isNaN());
     }
 
+    @Test
     public void testAsinInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.asin());
         TestUtils.assertSame(Complex.NaN, oneNegInf.asin());
@@ -389,12 +432,14 @@ public class ComplexTest extends TestCas
     }
 
 
+    @Test
     public void testAtan() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(1.44831, 0.158997);
         TestUtils.assertEquals(expected, z.atan(), 1.0e-5);
     }
 
+    @Test
     public void testAtanInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.atan());
         TestUtils.assertSame(Complex.NaN, oneNegInf.atan());
@@ -406,21 +451,25 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.atan());
     }
 
+    @Test
     public void testAtanNaN() {
-        assertTrue(Complex.NaN.atan().isNaN());
-        assertTrue(Complex.I.atan().isNaN());
+        Assert.assertTrue(Complex.NaN.atan().isNaN());
+        Assert.assertTrue(Complex.I.atan().isNaN());
     }
 
+    @Test
     public void testCos() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-27.03495, -3.851153);
         TestUtils.assertEquals(expected, z.cos(), 1.0e-5);
     }
 
+    @Test
     public void testCosNaN() {
-        assertTrue(Complex.NaN.cos().isNaN());
+        Assert.assertTrue(Complex.NaN.cos().isNaN());
     }
 
+    @Test
     public void testCosInf() {
         TestUtils.assertSame(infNegInf, oneInf.cos());
         TestUtils.assertSame(infInf, oneNegInf.cos());
@@ -432,16 +481,19 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.cos());
     }
 
+    @Test
     public void testCosh() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-6.58066, -7.58155);
         TestUtils.assertEquals(expected, z.cosh(), 1.0e-5);
     }
 
+    @Test
     public void testCoshNaN() {
-        assertTrue(Complex.NaN.cosh().isNaN());
+        Assert.assertTrue(Complex.NaN.cosh().isNaN());
     }
 
+    @Test
     public void testCoshInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.cosh());
         TestUtils.assertSame(Complex.NaN, oneNegInf.cosh());
@@ -453,6 +505,7 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.cosh());
     }
 
+    @Test
     public void testExp() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-13.12878, -15.20078);
@@ -464,10 +517,12 @@ public class ComplexTest extends TestCas
                 iPi.exp(), 10e-12);
     }
 
+    @Test
     public void testExpNaN() {
-        assertTrue(Complex.NaN.exp().isNaN());
+        Assert.assertTrue(Complex.NaN.exp().isNaN());
     }
 
+    @Test
     public void testExpInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.exp());
         TestUtils.assertSame(Complex.NaN, oneNegInf.exp());
@@ -479,16 +534,19 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.exp());
     }
 
+    @Test
     public void testLog() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(1.60944, 0.927295);
         TestUtils.assertEquals(expected, z.log(), 1.0e-5);
     }
 
+    @Test
     public void testLogNaN() {
-        assertTrue(Complex.NaN.log().isNaN());
+        Assert.assertTrue(Complex.NaN.log().isNaN());
     }
 
+    @Test
     public void testLogInf() {
         TestUtils.assertEquals(new Complex(inf, pi / 2),
                 oneInf.log(), 10e-12);
@@ -507,10 +565,12 @@ public class ComplexTest extends TestCas
                 negInfNegInf.log(), 10e-12);
     }
 
+    @Test
     public void testLogZero() {
         TestUtils.assertSame(negInfZero, Complex.ZERO.log());
     }
 
+    @Test
     public void testPow() {
         Complex x = new Complex(3, 4);
         Complex y = new Complex(5, 6);
@@ -518,16 +578,19 @@ public class ComplexTest extends TestCas
         TestUtils.assertEquals(expected, x.pow(y), 1.0e-5);
     }
 
+    @Test
     public void testPowNaNBase() {
         Complex x = new Complex(3, 4);
-        assertTrue(Complex.NaN.pow(x).isNaN());
+        Assert.assertTrue(Complex.NaN.pow(x).isNaN());
     }
 
+    @Test
     public void testPowNaNExponent() {
         Complex x = new Complex(3, 4);
-        assertTrue(x.pow(Complex.NaN).isNaN());
+        Assert.assertTrue(x.pow(Complex.NaN).isNaN());
     }
 
+   @Test
    public void testPowInf() {
        TestUtils.assertSame(Complex.NaN,Complex.ONE.pow(oneInf));
        TestUtils.assertSame(Complex.NaN,Complex.ONE.pow(oneNegInf));
@@ -553,6 +616,7 @@ public class ComplexTest extends TestCas
        TestUtils.assertSame(Complex.NaN,infNegInf.pow(infInf));
    }
 
+   @Test
    public void testPowZero() {
        TestUtils.assertSame(Complex.NaN,
                Complex.ZERO.pow(Complex.ONE));
@@ -568,21 +632,24 @@ public class ComplexTest extends TestCas
                new Complex(-1, 3).pow(Complex.ZERO), 10e-12);
    }
 
+    @Test
     public void testpowNull() {
         try {
             Complex.ONE.pow(null);
-            fail("Expecting NullPointerException");
+            Assert.fail("Expecting NullPointerException");
         } catch (NullPointerException ex) {
             // expected
         }
     }
 
+    @Test
     public void testSin() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(3.853738, -27.01681);
         TestUtils.assertEquals(expected, z.sin(), 1.0e-5);
     }
 
+    @Test
     public void testSinInf() {
         TestUtils.assertSame(infInf, oneInf.sin());
         TestUtils.assertSame(infNegInf, oneNegInf.sin());
@@ -594,20 +661,24 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.sin());
     }
 
+    @Test
     public void testSinNaN() {
-        assertTrue(Complex.NaN.sin().isNaN());
+        Assert.assertTrue(Complex.NaN.sin().isNaN());
     }
 
+    @Test
     public void testSinh() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-6.54812, -7.61923);
         TestUtils.assertEquals(expected, z.sinh(), 1.0e-5);
     }
 
+    @Test
     public void testSinhNaN() {
-        assertTrue(Complex.NaN.sinh().isNaN());
+        Assert.assertTrue(Complex.NaN.sinh().isNaN());
     }
 
+    @Test
     public void testSinhInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.sinh());
         TestUtils.assertSame(Complex.NaN, oneNegInf.sinh());
@@ -619,36 +690,42 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.sinh());
     }
 
+    @Test
     public void testSqrtRealPositive() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(2, 1);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
 
+    @Test
     public void testSqrtRealZero() {
         Complex z = new Complex(0.0, 4);
         Complex expected = new Complex(1.41421, 1.41421);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
 
+    @Test
     public void testSqrtRealNegative() {
         Complex z = new Complex(-3.0, 4);
         Complex expected = new Complex(1, 2);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
 
+    @Test
     public void testSqrtImaginaryZero() {
         Complex z = new Complex(-3.0, 0.0);
         Complex expected = new Complex(0.0, 1.73205);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
 
+    @Test
     public void testSqrtImaginaryNegative() {
         Complex z = new Complex(-3.0, -4.0);
         Complex expected = new Complex(1.0, -2.0);
         TestUtils.assertEquals(expected, z.sqrt(), 1.0e-5);
     }
 
+    @Test
     public void testSqrtPolar() {
         double r = 1;
         for (int i = 0; i < 5; i++) {
@@ -663,10 +740,12 @@ public class ComplexTest extends TestCas
         }
     }
 
+    @Test
     public void testSqrtNaN() {
-        assertTrue(Complex.NaN.sqrt().isNaN());
+        Assert.assertTrue(Complex.NaN.sqrt().isNaN());
     }
 
+    @Test
     public void testSqrtInf() {
         TestUtils.assertSame(infNaN, oneInf.sqrt());
         TestUtils.assertSame(infNaN, oneNegInf.sqrt());
@@ -678,26 +757,31 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(nanNegInf, negInfNegInf.sqrt());
     }
 
+    @Test
     public void testSqrt1z() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(4.08033, -2.94094);
         TestUtils.assertEquals(expected, z.sqrt1z(), 1.0e-5);
     }
 
+    @Test
     public void testSqrt1zNaN() {
-        assertTrue(Complex.NaN.sqrt1z().isNaN());
+        Assert.assertTrue(Complex.NaN.sqrt1z().isNaN());
     }
 
+    @Test
     public void testTan() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(-0.000187346, 0.999356);
         TestUtils.assertEquals(expected, z.tan(), 1.0e-5);
     }
 
+    @Test
     public void testTanNaN() {
-        assertTrue(Complex.NaN.tan().isNaN());
+        Assert.assertTrue(Complex.NaN.tan().isNaN());
     }
 
+    @Test
     public void testTanInf() {
         TestUtils.assertSame(zeroNaN, oneInf.tan());
         TestUtils.assertSame(zeroNaN, oneNegInf.tan());
@@ -709,21 +793,25 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.tan());
     }
 
+   @Test
    public void testTanCritical() {
         TestUtils.assertSame(infNaN, new Complex(pi/2, 0).tan());
         TestUtils.assertSame(negInfNaN, new Complex(-pi/2, 0).tan());
     }
 
+    @Test
     public void testTanh() {
         Complex z = new Complex(3, 4);
         Complex expected = new Complex(1.00071, 0.00490826);
         TestUtils.assertEquals(expected, z.tanh(), 1.0e-5);
     }
 
+    @Test
     public void testTanhNaN() {
-        assertTrue(Complex.NaN.tanh().isNaN());
+        Assert.assertTrue(Complex.NaN.tanh().isNaN());
     }
 
+    @Test
     public void testTanhInf() {
         TestUtils.assertSame(Complex.NaN, oneInf.tanh());
         TestUtils.assertSame(Complex.NaN, oneNegInf.tanh());
@@ -735,13 +823,15 @@ public class ComplexTest extends TestCas
         TestUtils.assertSame(Complex.NaN, negInfNegInf.tanh());
     }
 
+    @Test
     public void testTanhCritical() {
         TestUtils.assertSame(nanInf, new Complex(0, pi/2).tanh());
     }
 
     /** test issue MATH-221 */
+    @Test
     public void testMath221() {
-        assertEquals(new Complex(0,-1), new Complex(0,1).multiply(new Complex(-1,0)));
+        Assert.assertEquals(new Complex(0,-1), new Complex(0,1).multiply(new Complex(-1,0)));
     }
 
     /**
@@ -755,22 +845,23 @@ public class ComplexTest extends TestCas
      * </code>
      * </pre>
      */
+    @Test
     public void testNthRoot_normal_thirdRoot() {
         // The complex number we want to compute all third-roots for.
         Complex z = new Complex(-2,2);
         // The List holding all third roots
         Complex[] thirdRootsOfZ = z.nthRoot(3).toArray(new Complex[0]);
         // Returned Collection must not be empty!
-        assertEquals(3, thirdRootsOfZ.length);
+        Assert.assertEquals(3, thirdRootsOfZ.length);
         // test z_0
-        assertEquals(1.0,                  thirdRootsOfZ[0].getReal(),      1.0e-5);
-        assertEquals(1.0,                  thirdRootsOfZ[0].getImaginary(), 1.0e-5);
+        Assert.assertEquals(1.0,                  thirdRootsOfZ[0].getReal(),      1.0e-5);
+        Assert.assertEquals(1.0,                  thirdRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
-        assertEquals(-1.3660254037844386,  thirdRootsOfZ[1].getReal(),      1.0e-5);
-        assertEquals(0.36602540378443843,  thirdRootsOfZ[1].getImaginary(), 1.0e-5);
+        Assert.assertEquals(-1.3660254037844386,  thirdRootsOfZ[1].getReal(),      1.0e-5);
+        Assert.assertEquals(0.36602540378443843,  thirdRootsOfZ[1].getImaginary(), 1.0e-5);
         // test z_2
-        assertEquals(0.366025403784439,    thirdRootsOfZ[2].getReal(),      1.0e-5);
-        assertEquals(-1.3660254037844384,  thirdRootsOfZ[2].getImaginary(), 1.0e-5);
+        Assert.assertEquals(0.366025403784439,    thirdRootsOfZ[2].getReal(),      1.0e-5);
+        Assert.assertEquals(-1.3660254037844384,  thirdRootsOfZ[2].getImaginary(), 1.0e-5);
     }
 
 
@@ -786,25 +877,26 @@ public class ComplexTest extends TestCas
      * </code>
      * </pre>
      */
+    @Test
     public void testNthRoot_normal_fourthRoot() {
         // The complex number we want to compute all third-roots for.
         Complex z = new Complex(5,-2);
         // The List holding all fourth roots
         Complex[] fourthRootsOfZ = z.nthRoot(4).toArray(new Complex[0]);
         // Returned Collection must not be empty!
-        assertEquals(4, fourthRootsOfZ.length);
+        Assert.assertEquals(4, fourthRootsOfZ.length);
         // test z_0
-        assertEquals(1.5164629308487783,     fourthRootsOfZ[0].getReal(),      1.0e-5);
-        assertEquals(-0.14469266210702247,   fourthRootsOfZ[0].getImaginary(), 1.0e-5);
+        Assert.assertEquals(1.5164629308487783,     fourthRootsOfZ[0].getReal(),      1.0e-5);
+        Assert.assertEquals(-0.14469266210702247,   fourthRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
-        assertEquals(0.14469266210702256,    fourthRootsOfZ[1].getReal(),      1.0e-5);
-        assertEquals(1.5164629308487783,     fourthRootsOfZ[1].getImaginary(), 1.0e-5);
+        Assert.assertEquals(0.14469266210702256,    fourthRootsOfZ[1].getReal(),      1.0e-5);
+        Assert.assertEquals(1.5164629308487783,     fourthRootsOfZ[1].getImaginary(), 1.0e-5);
         // test z_2
-        assertEquals(-1.5164629308487783,    fourthRootsOfZ[2].getReal(),      1.0e-5);
-        assertEquals(0.14469266210702267,    fourthRootsOfZ[2].getImaginary(), 1.0e-5);
+        Assert.assertEquals(-1.5164629308487783,    fourthRootsOfZ[2].getReal(),      1.0e-5);
+        Assert.assertEquals(0.14469266210702267,    fourthRootsOfZ[2].getImaginary(), 1.0e-5);
         // test z_3
-        assertEquals(-0.14469266210702275,   fourthRootsOfZ[3].getReal(),      1.0e-5);
-        assertEquals(-1.5164629308487783,    fourthRootsOfZ[3].getImaginary(), 1.0e-5);
+        Assert.assertEquals(-0.14469266210702275,   fourthRootsOfZ[3].getReal(),      1.0e-5);
+        Assert.assertEquals(-1.5164629308487783,    fourthRootsOfZ[3].getImaginary(), 1.0e-5);
     }
 
     /**
@@ -818,6 +910,7 @@ public class ComplexTest extends TestCas
      * </code>
      * </pre>
      */
+    @Test
     public void testNthRoot_cornercase_thirdRoot_imaginaryPartEmpty() {
         // The number 8 has three third roots. One we all already know is the number 2.
         // But there are two more complex roots.
@@ -825,16 +918,16 @@ public class ComplexTest extends TestCas
         // The List holding all third roots
         Complex[] thirdRootsOfZ = z.nthRoot(3).toArray(new Complex[0]);
         // Returned Collection must not be empty!
-        assertEquals(3, thirdRootsOfZ.length);
+        Assert.assertEquals(3, thirdRootsOfZ.length);
         // test z_0
-        assertEquals(2.0,                thirdRootsOfZ[0].getReal(),      1.0e-5);
-        assertEquals(0.0,                thirdRootsOfZ[0].getImaginary(), 1.0e-5);
+        Assert.assertEquals(2.0,                thirdRootsOfZ[0].getReal(),      1.0e-5);
+        Assert.assertEquals(0.0,                thirdRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
-        assertEquals(-1.0,               thirdRootsOfZ[1].getReal(),      1.0e-5);
-        assertEquals(1.7320508075688774, thirdRootsOfZ[1].getImaginary(), 1.0e-5);
+        Assert.assertEquals(-1.0,               thirdRootsOfZ[1].getReal(),      1.0e-5);
+        Assert.assertEquals(1.7320508075688774, thirdRootsOfZ[1].getImaginary(), 1.0e-5);
         // test z_2
-        assertEquals(-1.0,               thirdRootsOfZ[2].getReal(),      1.0e-5);
-        assertEquals(-1.732050807568877, thirdRootsOfZ[2].getImaginary(), 1.0e-5);
+        Assert.assertEquals(-1.0,               thirdRootsOfZ[2].getReal(),      1.0e-5);
+        Assert.assertEquals(-1.732050807568877, thirdRootsOfZ[2].getImaginary(), 1.0e-5);
     }
 
 
@@ -849,123 +942,129 @@ public class ComplexTest extends TestCas
      * </code>
      * </pre>
      */
+    @Test
     public void testNthRoot_cornercase_thirdRoot_realPartZero() {
         // complex number with only imaginary part
         Complex z = new Complex(0,2);
         // The List holding all third roots
         Complex[] thirdRootsOfZ = z.nthRoot(3).toArray(new Complex[0]);
         // Returned Collection must not be empty!
-        assertEquals(3, thirdRootsOfZ.length);
+        Assert.assertEquals(3, thirdRootsOfZ.length);
         // test z_0
-        assertEquals(1.0911236359717216,      thirdRootsOfZ[0].getReal(),      1.0e-5);
-        assertEquals(0.6299605249474365,      thirdRootsOfZ[0].getImaginary(), 1.0e-5);
+        Assert.assertEquals(1.0911236359717216,      thirdRootsOfZ[0].getReal(),      1.0e-5);
+        Assert.assertEquals(0.6299605249474365,      thirdRootsOfZ[0].getImaginary(), 1.0e-5);
         // test z_1
-        assertEquals(-1.0911236359717216,     thirdRootsOfZ[1].getReal(),      1.0e-5);
-        assertEquals(0.6299605249474365,      thirdRootsOfZ[1].getImaginary(), 1.0e-5);
+        Assert.assertEquals(-1.0911236359717216,     thirdRootsOfZ[1].getReal(),      1.0e-5);
+        Assert.assertEquals(0.6299605249474365,      thirdRootsOfZ[1].getImaginary(), 1.0e-5);
         // test z_2
-        assertEquals(-2.3144374213981936E-16, thirdRootsOfZ[2].getReal(),      1.0e-5);
-        assertEquals(-1.2599210498948732,     thirdRootsOfZ[2].getImaginary(), 1.0e-5);
+        Assert.assertEquals(-2.3144374213981936E-16, thirdRootsOfZ[2].getReal(),      1.0e-5);
+        Assert.assertEquals(-1.2599210498948732,     thirdRootsOfZ[2].getImaginary(), 1.0e-5);
     }
 
     /**
      * Test cornercases with NaN and Infinity.
      */
+    @Test
     public void testNthRoot_cornercase_NAN_Inf() {
         // NaN + finite -> NaN
         List<Complex> roots = oneNaN.nthRoot(3);
-        assertEquals(1,roots.size());
-        assertEquals(Complex.NaN, roots.get(0));
+        Assert.assertEquals(1,roots.size());
+        Assert.assertEquals(Complex.NaN, roots.get(0));
 
         roots = nanZero.nthRoot(3);
-        assertEquals(1,roots.size());
-        assertEquals(Complex.NaN, roots.get(0));
+        Assert.assertEquals(1,roots.size());
+        Assert.assertEquals(Complex.NaN, roots.get(0));
 
         // NaN + infinite -> NaN
         roots = nanInf.nthRoot(3);
-        assertEquals(1,roots.size());
-        assertEquals(Complex.NaN, roots.get(0));
+        Assert.assertEquals(1,roots.size());
+        Assert.assertEquals(Complex.NaN, roots.get(0));
 
         // finite + infinite -> Inf
         roots = oneInf.nthRoot(3);
-        assertEquals(1,roots.size());
-        assertEquals(Complex.INF, roots.get(0));
+        Assert.assertEquals(1,roots.size());
+        Assert.assertEquals(Complex.INF, roots.get(0));
 
         // infinite + infinite -> Inf
         roots = negInfInf.nthRoot(3);
-        assertEquals(1,roots.size());
-        assertEquals(Complex.INF, roots.get(0));
+        Assert.assertEquals(1,roots.size());
+        Assert.assertEquals(Complex.INF, roots.get(0));
     }
 
     /**
      * Test standard values
      */
+    @Test
     public void testGetArgument() {
         Complex z = new Complex(1, 0);
-        assertEquals(0.0, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(0.0, z.getArgument(), 1.0e-12);
 
         z = new Complex(1, 1);
-        assertEquals(FastMath.PI/4, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(FastMath.PI/4, z.getArgument(), 1.0e-12);
 
         z = new Complex(0, 1);
-        assertEquals(FastMath.PI/2, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(FastMath.PI/2, z.getArgument(), 1.0e-12);
 
         z = new Complex(-1, 1);
-        assertEquals(3 * FastMath.PI/4, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(3 * FastMath.PI/4, z.getArgument(), 1.0e-12);
 
         z = new Complex(-1, 0);
-        assertEquals(FastMath.PI, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(FastMath.PI, z.getArgument(), 1.0e-12);
 
         z = new Complex(-1, -1);
-        assertEquals(-3 * FastMath.PI/4, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(-3 * FastMath.PI/4, z.getArgument(), 1.0e-12);
 
         z = new Complex(0, -1);
-        assertEquals(-FastMath.PI/2, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(-FastMath.PI/2, z.getArgument(), 1.0e-12);
 
         z = new Complex(1, -1);
-        assertEquals(-FastMath.PI/4, z.getArgument(), 1.0e-12);
+        Assert.assertEquals(-FastMath.PI/4, z.getArgument(), 1.0e-12);
 
     }
 
     /**
      * Verify atan2-style handling of infinite parts
      */
+    @Test
     public void testGetArgumentInf() {
-        assertEquals(FastMath.PI/4, infInf.getArgument(), 1.0e-12);
-        assertEquals(FastMath.PI/2, oneInf.getArgument(), 1.0e-12);
-        assertEquals(0.0, infOne.getArgument(), 1.0e-12);
-        assertEquals(FastMath.PI/2, zeroInf.getArgument(), 1.0e-12);
-        assertEquals(0.0, infZero.getArgument(), 1.0e-12);
-        assertEquals(FastMath.PI, negInfOne.getArgument(), 1.0e-12);
-        assertEquals(-3.0*FastMath.PI/4, negInfNegInf.getArgument(), 1.0e-12);
-        assertEquals(-FastMath.PI/2, oneNegInf.getArgument(), 1.0e-12);
+        Assert.assertEquals(FastMath.PI/4, infInf.getArgument(), 1.0e-12);
+        Assert.assertEquals(FastMath.PI/2, oneInf.getArgument(), 1.0e-12);
+        Assert.assertEquals(0.0, infOne.getArgument(), 1.0e-12);
+        Assert.assertEquals(FastMath.PI/2, zeroInf.getArgument(), 1.0e-12);
+        Assert.assertEquals(0.0, infZero.getArgument(), 1.0e-12);
+        Assert.assertEquals(FastMath.PI, negInfOne.getArgument(), 1.0e-12);
+        Assert.assertEquals(-3.0*FastMath.PI/4, negInfNegInf.getArgument(), 1.0e-12);
+        Assert.assertEquals(-FastMath.PI/2, oneNegInf.getArgument(), 1.0e-12);
     }
 
     /**
      * Verify that either part NaN results in NaN
      */
+    @Test
     public void testGetArgumentNaN() {
-        assertEquals(nan, nanZero.getArgument());
-        assertEquals(nan, zeroNaN.getArgument());
-        assertEquals(nan, Complex.NaN.getArgument());
+        Assert.assertTrue(Double.isNaN(nanZero.getArgument()));
+        Assert.assertTrue(Double.isNaN(zeroNaN.getArgument()));
+        Assert.assertTrue(Double.isNaN(Complex.NaN.getArgument()));
     }
 
+    @Test
     public void testSerial() {
         Complex z = new Complex(3.0, 4.0);
-        assertEquals(z, TestUtils.serializeAndRecover(z));
+        Assert.assertEquals(z, TestUtils.serializeAndRecover(z));
         Complex ncmplx = (Complex)TestUtils.serializeAndRecover(oneNaN);
-        assertEquals(nanZero, ncmplx);
-        assertTrue(ncmplx.isNaN());
+        Assert.assertEquals(nanZero, ncmplx);
+        Assert.assertTrue(ncmplx.isNaN());
         Complex infcmplx = (Complex)TestUtils.serializeAndRecover(infInf);
-        assertEquals(infInf, infcmplx);
-        assertTrue(infcmplx.isInfinite());
+        Assert.assertEquals(infInf, infcmplx);
+        Assert.assertTrue(infcmplx.isInfinite());
         TestComplex tz = new TestComplex(3.0, 4.0);
-        assertEquals(tz, TestUtils.serializeAndRecover(tz));
+        Assert.assertEquals(tz, TestUtils.serializeAndRecover(tz));
         TestComplex ntcmplx = (TestComplex)TestUtils.serializeAndRecover(new TestComplex(oneNaN));
-        assertEquals(nanZero, ntcmplx);
-        assertTrue(ntcmplx.isNaN());
+        Assert.assertEquals(nanZero, ntcmplx);
+        Assert.assertTrue(ntcmplx.isNaN());
         TestComplex inftcmplx = (TestComplex)TestUtils.serializeAndRecover(new TestComplex(infInf));
-        assertEquals(infInf, inftcmplx);
-        assertTrue(inftcmplx.isInfinite());
+        Assert.assertEquals(infInf, inftcmplx);
+        Assert.assertTrue(inftcmplx.isInfinite());
     }
 
     /**

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexUtilsTest.java Sun Mar 20 17:24:14 2011
@@ -19,13 +19,14 @@ package org.apache.commons.math.complex;
 
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.util.FastMath;
+import org.junit.Assert;
+import org.junit.Test;
 
-import junit.framework.TestCase;
 
 /**
  * @version $Revision$ $Date$
  */
-public class ComplexUtilsTest extends TestCase {
+public class ComplexUtilsTest {
 
     private double inf = Double.POSITIVE_INFINITY;
     private double negInf = Double.NEGATIVE_INFINITY;
@@ -38,6 +39,7 @@ public class ComplexUtilsTest extends Te
     private Complex negInfNegInf = new Complex(negInf, negInf);
     private Complex infNaN = new Complex(inf, nan);
 
+    @Test
     public void testPolar2Complex() {
         TestUtils.assertEquals(Complex.ONE,
                 ComplexUtils.polar2Complex(1, 0), 10e-12);
@@ -71,15 +73,17 @@ public class ComplexUtilsTest extends Te
         return Complex.I.multiply(new Complex(theta, 0)).exp().multiply(new Complex(r, 0));
     }
 
+    @Test
     public void testPolar2ComplexIllegalModulus() {
         try {
             ComplexUtils.polar2Complex(-1, 0);
-            fail("Expecting IllegalArgumentException");
+            Assert.fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
 
+    @Test
     public void testPolar2ComplexNaN() {
         TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(nan, 1));
         TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(1, nan));
@@ -87,6 +91,7 @@ public class ComplexUtilsTest extends Te
                 ComplexUtils.polar2Complex(nan, nan));
     }
 
+    @Test
     public void testPolar2ComplexInf() {
         TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(1, inf));
         TestUtils.assertSame(Complex.NaN,

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BetaDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BetaDistributionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BetaDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BetaDistributionTest.java Sun Mar 20 17:24:14 2011
@@ -16,10 +16,12 @@
  */
 package org.apache.commons.math.distribution;
 
-import junit.framework.TestCase;
 import org.apache.commons.math.MathException;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class BetaDistributionTest extends TestCase {
+public class BetaDistributionTest {
+    @Test
     public void testCumulative() throws MathException {
         double[] x = new double[]{-0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1};
         // all test data computed using R 2.5
@@ -142,14 +144,15 @@ public class BetaDistributionTest extend
     private void checkCumulative(double alpha, double beta, double[] x, double[] cumes) throws MathException {
         BetaDistribution d = new BetaDistributionImpl(alpha, beta);
         for (int i = 0; i < x.length; i++) {
-            assertEquals(cumes[i], d.cumulativeProbability(x[i]), 1e-8);
+            Assert.assertEquals(cumes[i], d.cumulativeProbability(x[i]), 1e-8);
         }
 
         for (int i = 1; i < x.length - 1; i++) {
-            assertEquals(x[i], d.inverseCumulativeProbability(cumes[i]), 1e-5);
+            Assert.assertEquals(x[i], d.inverseCumulativeProbability(cumes[i]), 1e-5);
         }
     }
 
+    @Test
     public void testDensity() {
         double[] x = new double[]{1e-6, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9};
         checkDensity(0.1, 0.1,
@@ -283,20 +286,21 @@ public class BetaDistributionTest extend
     private void checkDensity(double alpha, double beta, double[] x, double[] expected) {
         BetaDistribution d = new BetaDistributionImpl(alpha, beta);
         for (int i = 0; i < x.length; i++) {
-            assertEquals(String.format("density at x=%.1f for alpha=%.1f, beta=%.1f", x[i], alpha, beta), expected[i], d.density(x[i]), 1e-5);
+            Assert.assertEquals(String.format("density at x=%.1f for alpha=%.1f, beta=%.1f", x[i], alpha, beta), expected[i], d.density(x[i]), 1e-5);
         }
     }
 
+    @Test
     public void testMomonts() {
         final double tol = 1e-9;
         BetaDistribution dist;
         
         dist = new BetaDistributionImpl(1, 1);
-        assertEquals(dist.getNumericalMean(), 0.5, tol);
-        assertEquals(dist.getNumericalVariance(), 1.0 / 12.0, tol); 
+        Assert.assertEquals(dist.getNumericalMean(), 0.5, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 1.0 / 12.0, tol); 
         
         dist = new BetaDistributionImpl(2, 5);
-        assertEquals(dist.getNumericalMean(), 2.0 / 7.0, tol);
-        assertEquals(dist.getNumericalVariance(), 10.0 / (49.0 * 8.0), tol); 
+        Assert.assertEquals(dist.getNumericalMean(), 2.0 / 7.0, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 10.0 / (49.0 * 8.0), tol); 
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BinomialDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BinomialDistributionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BinomialDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/BinomialDistributionTest.java Sun Mar 20 17:24:14 2011
@@ -13,6 +13,9 @@
  */
 package org.apache.commons.math.distribution;
 
+import org.junit.Assert;
+import org.junit.Test;
+
 /**
  * Test cases for BinomialDistribution. Extends IntegerDistributionAbstractTest.
  * See class javadoc for IntegerDistributionAbstractTest for details.
@@ -22,15 +25,6 @@ package org.apache.commons.math.distribu
  */
 public class BinomialDistributionTest extends IntegerDistributionAbstractTest {
 
-    /**
-     * Constructor for BinomialDistributionTest.
-     *
-     * @param name
-     */
-    public BinomialDistributionTest(String name) {
-        super(name);
-    }
-
     // -------------- Implementations for abstract methods
     // -----------------------
 
@@ -86,6 +80,7 @@ public class BinomialDistributionTest ex
     // ----------------- Additional test cases ---------------------------------
 
     /** Test degenerate case p = 0 */
+    @Test
     public void testDegenerate0() throws Exception {
         setDistribution(new BinomialDistributionImpl(5, 0.0d));
         setCumulativeTestPoints(new int[] { -1, 0, 1, 5, 10 });
@@ -100,6 +95,7 @@ public class BinomialDistributionTest ex
     }
 
     /** Test degenerate case p = 1 */
+    @Test
     public void testDegenerate1() throws Exception {
         setDistribution(new BinomialDistributionImpl(5, 1.0d));
         setCumulativeTestPoints(new int[] { -1, 0, 1, 2, 5, 10 });
@@ -113,17 +109,18 @@ public class BinomialDistributionTest ex
         verifyInverseCumulativeProbabilities();
     }
 
+    @Test
     public void testMomonts() {
         final double tol = 1e-9;
         BinomialDistribution dist;
         
         dist = new BinomialDistributionImpl(10, 0.5);
-        assertEquals(dist.getNumericalMean(), 10d * 0.5d, tol);
-        assertEquals(dist.getNumericalVariance(), 10d * 0.5d * 0.5d, tol); 
+        Assert.assertEquals(dist.getNumericalMean(), 10d * 0.5d, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 10d * 0.5d * 0.5d, tol); 
         
         dist = new BinomialDistributionImpl(30, 0.3);
-        assertEquals(dist.getNumericalMean(), 30d * 0.3d, tol);
-        assertEquals(dist.getNumericalVariance(), 30d * 0.3d * (1d - 0.3d), tol);
+        Assert.assertEquals(dist.getNumericalMean(), 30d * 0.3d, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 30d * 0.3d * (1d - 0.3d), tol);
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/CauchyDistributionTest.java Sun Mar 20 17:24:14 2011
@@ -18,6 +18,8 @@
 package org.apache.commons.math.distribution;
 
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Test cases for CauchyDistribution.
@@ -28,18 +30,10 @@ import org.apache.commons.math.exception
  */
 public class CauchyDistributionTest extends ContinuousDistributionAbstractTest  {
 
-    /**
-     * Constructor for CauchyDistributionTest.
-     * @param arg0
-     */
-    public CauchyDistributionTest(String arg0) {
-        super(arg0);
-    }
-
     // --------------------- Override tolerance  --------------
     protected double defaultTolerance = NormalDistributionImpl.DEFAULT_INVERSE_ABSOLUTE_ACCURACY;
     @Override
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         super.setUp();
         setTolerance(defaultTolerance);
     }
@@ -76,6 +70,7 @@ public class CauchyDistributionTest exte
 
     //---------------------------- Additional test cases -------------------------
 
+    @Test
     public void testInverseCumulativeProbabilityExtremes() throws Exception {
         setInverseCumulativeTestPoints(new double[] {0.0, 1.0});
         setInverseCumulativeTestValues(
@@ -83,40 +78,44 @@ public class CauchyDistributionTest exte
         verifyInverseCumulativeProbabilities();
     }
 
+    @Test
     public void testMedian() {
         CauchyDistribution distribution = (CauchyDistribution) getDistribution();
-        assertEquals(1.2, distribution.getMedian(), 0.0);
+        Assert.assertEquals(1.2, distribution.getMedian(), 0.0);
     }
 
+    @Test
     public void testScale() {
         CauchyDistribution distribution = (CauchyDistribution) getDistribution();
-        assertEquals(2.1, distribution.getScale(), 0.0);
+        Assert.assertEquals(2.1, distribution.getScale(), 0.0);
     }
 
+    @Test
     public void testPreconditions() {
         try {
             new CauchyDistributionImpl(0, 0);
-            fail("Cannot have zero scale");
+            Assert.fail("Cannot have zero scale");
         } catch (NotStrictlyPositiveException ex) {
             // Expected.
         }
         try {
             new CauchyDistributionImpl(0, -1);
-            fail("Cannot have negative scale");
+            Assert.fail("Cannot have negative scale");
         } catch (NotStrictlyPositiveException ex) {
             // Expected.
         }
     }
 
+    @Test
     public void testMomonts() {
         CauchyDistribution dist;
         
         dist = new CauchyDistributionImpl(10.2, 0.15);        
-        assertTrue(Double.isNaN(dist.getNumericalMean()));
-        assertTrue(Double.isNaN(dist.getNumericalVariance()));
+        Assert.assertTrue(Double.isNaN(dist.getNumericalMean()));
+        Assert.assertTrue(Double.isNaN(dist.getNumericalVariance()));
         
         dist = new CauchyDistributionImpl(23.12, 2.12);
-        assertTrue(Double.isNaN(dist.getNumericalMean()));
-        assertTrue(Double.isNaN(dist.getNumericalVariance()));
+        Assert.assertTrue(Double.isNaN(dist.getNumericalMean()));
+        Assert.assertTrue(Double.isNaN(dist.getNumericalVariance()));
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java Sun Mar 20 17:24:14 2011
@@ -17,6 +17,9 @@
 
 package org.apache.commons.math.distribution;
 
+import org.junit.Assert;
+import org.junit.Test;
+
 /**
  * Test cases for ChiSquareDistribution.
  * Extends ContinuousDistributionAbstractTest.  See class javadoc for
@@ -26,14 +29,6 @@ package org.apache.commons.math.distribu
  */
 public class ChiSquareDistributionTest extends ContinuousDistributionAbstractTest {
 
-    /**
-     * Constructor for ChiSquareDistributionTest.
-     * @param name
-     */
-    public ChiSquareDistributionTest(String name) {
-        super(name);
-    }
-
     //-------------- Implementations for abstract methods -----------------------
 
     /** Creates the default continuous distribution instance to use in tests. */
@@ -80,13 +75,14 @@ public class ChiSquareDistributionTest e
 
  // --------------------- Override tolerance  --------------
     @Override
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         super.setUp();
         setTolerance(1e-9);
     }
 
  //---------------------------- Additional test cases -------------------------
 
+    @Test
     public void testSmallDf() throws Exception {
         setDistribution(new ChiSquaredDistributionImpl(0.1d));
         setTolerance(1E-4);
@@ -100,11 +96,13 @@ public class ChiSquareDistributionTest e
         verifyInverseCumulativeProbabilities();
     }
 
+    @Test
     public void testDfAccessors() {
         ChiSquaredDistribution distribution = (ChiSquaredDistribution) getDistribution();
-        assertEquals(5d, distribution.getDegreesOfFreedom(), Double.MIN_VALUE);
+        Assert.assertEquals(5d, distribution.getDegreesOfFreedom(), Double.MIN_VALUE);
     }
 
+    @Test
     public void testDensity() {
         double[] x = new double[]{-0.1, 1e-6, 0.5, 1, 2, 5};
         //R 2.5: print(dchisq(x, df=1), digits=10)
@@ -120,21 +118,22 @@ public class ChiSquareDistributionTest e
     private void checkDensity(double df, double[] x, double[] expected) {
         ChiSquaredDistribution d = new ChiSquaredDistributionImpl(df);
         for (int i = 0; i < x.length; i++) {
-            assertEquals(expected[i], d.density(x[i]), 1e-5);
+            Assert.assertEquals(expected[i], d.density(x[i]), 1e-5);
         }
     }
 
+    @Test
     public void testMomonts() {
         final double tol = 1e-9;
         ChiSquaredDistribution dist;
         
         dist = new ChiSquaredDistributionImpl(1500);
-        assertEquals(dist.getNumericalMean(), 1500, tol);
-        assertEquals(dist.getNumericalVariance(), 3000, tol); 
+        Assert.assertEquals(dist.getNumericalMean(), 1500, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 3000, tol); 
         
         dist = new ChiSquaredDistributionImpl(1.12);
-        assertEquals(dist.getNumericalMean(), 1.12, tol);
-        assertEquals(dist.getNumericalVariance(), 2.24, tol);
+        Assert.assertEquals(dist.getNumericalMean(), 1.12, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 2.24, tol);
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ContinuousDistributionAbstractTest.java Sun Mar 20 17:24:14 2011
@@ -16,11 +16,14 @@
  */
 package org.apache.commons.math.distribution;
 
-import junit.framework.TestCase;
 
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Abstract base class for {@link ContinuousDistribution} tests.
@@ -56,7 +59,7 @@ import org.apache.commons.math.exception
  *
  * @version $Revision$ $Date$
  */
-public abstract class ContinuousDistributionAbstractTest extends TestCase {
+public abstract class ContinuousDistributionAbstractTest {
 
 //-------------------- Private test instance data -------------------------
     /**  Distribution instance used to perform tests */
@@ -80,16 +83,6 @@ public abstract class ContinuousDistribu
     /** Values used to test density calculations */
     private double[] densityTestValues;
 
-    //-------------------------------------------------------------------------
-
-    /**
-     * Constructor for ContinuousDistributionAbstractTest.
-     * @param name
-     */
-    public ContinuousDistributionAbstractTest(String name) {
-        super(name);
-    }
-
     //-------------------- Abstract methods -----------------------------------
 
     /** Creates the default continuous distribution instance to use in tests. */
@@ -121,9 +114,8 @@ public abstract class ContinuousDistribu
     /**
      * Setup sets all test instance data to default values
      */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         distribution = makeDistribution();
         cumulativeTestPoints = makeCumulativeTestPoints();
         cumulativeTestValues = makeCumulativeTestValues();
@@ -135,9 +127,8 @@ public abstract class ContinuousDistribu
     /**
      * Cleans up test instance data
      */
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         distribution = null;
         cumulativeTestPoints = null;
         cumulativeTestValues = null;
@@ -193,6 +184,7 @@ public abstract class ContinuousDistribu
      * Verifies that cumulative probability density calculations match expected values
      * using default test instance data
      */
+    @Test
     public void testCumulativeProbabilities() throws Exception {
         verifyCumulativeProbabilities();
     }
@@ -201,6 +193,7 @@ public abstract class ContinuousDistribu
      * Verifies that inverse cumulative probability density calculations match expected values
      * using default test instance data
      */
+    @Test
     public void testInverseCumulativeProbabilities() throws Exception {
         verifyInverseCumulativeProbabilities();
     }
@@ -209,6 +202,7 @@ public abstract class ContinuousDistribu
      * Verifies that density calculations return expected values
      * for default test instance data
      */
+    @Test
     public void testDensities() throws Exception {
         verifyDensities();
     }
@@ -216,6 +210,7 @@ public abstract class ContinuousDistribu
     /**
      * Verifies that probability computations are consistent
      */
+    @Test
     public void testConsistency() throws Exception {
         for (int i=1; i < cumulativeTestPoints.length; i++) {
 
@@ -238,22 +233,23 @@ public abstract class ContinuousDistribu
     /**
      * Verifies that illegal arguments are correctly handled
      */
+    @Test
     public void testIllegalArguments() throws Exception {
         try {
             distribution.cumulativeProbability(1, 0);
-            fail("Expecting MathIllegalArgumentException for bad cumulativeProbability interval");
+            Assert.fail("Expecting MathIllegalArgumentException for bad cumulativeProbability interval");
         } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
             distribution.inverseCumulativeProbability(-1);
-            fail("Expecting MathIllegalArgumentException for p = -1");
+            Assert.fail("Expecting MathIllegalArgumentException for p = -1");
         } catch (MathIllegalArgumentException ex) {
             // expected
         }
         try {
             distribution.inverseCumulativeProbability(2);
-            fail("Expecting MathIllegalArgumentException for p = 2");
+            Assert.fail("Expecting MathIllegalArgumentException for p = 2");
         } catch (MathIllegalArgumentException ex) {
             // expected
         }
@@ -262,6 +258,7 @@ public abstract class ContinuousDistribu
     /**
      * Test sampling
      */
+    @Test
     public void testSampling() throws Exception {
         AbstractContinuousDistribution dist = (AbstractContinuousDistribution) makeDistribution();
         final int sampleSize = 1000;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ExponentialDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ExponentialDistributionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ExponentialDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ExponentialDistributionTest.java Sun Mar 20 17:24:14 2011
@@ -17,7 +17,10 @@
 package org.apache.commons.math.distribution;
 
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Test cases for ExponentialDistribution.
@@ -28,17 +31,9 @@ import org.apache.commons.math.exception
  */
 public class ExponentialDistributionTest extends ContinuousDistributionAbstractTest {
 
-    /**
-     * Constructor for ExponentialDistributionTest.
-     * @param name
-     */
-    public ExponentialDistributionTest(String name) {
-        super(name);
-    }
-
     // --------------------- Override tolerance  --------------
     @Override
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         super.setUp();
         setTolerance(1E-9);
     }
@@ -75,64 +70,71 @@ public class ExponentialDistributionTest
 
     //------------ Additional tests -------------------------------------------
 
+    @Test
     public void testCumulativeProbabilityExtremes() throws Exception {
         setCumulativeTestPoints(new double[] {-2, 0});
         setCumulativeTestValues(new double[] {0, 0});
         verifyCumulativeProbabilities();
     }
 
+    @Test
     public void testInverseCumulativeProbabilityExtremes() throws Exception {
          setInverseCumulativeTestPoints(new double[] {0, 1});
          setInverseCumulativeTestValues(new double[] {0, Double.POSITIVE_INFINITY});
          verifyInverseCumulativeProbabilities();
     }
 
+    @Test
     public void testCumulativeProbability2() throws Exception {
         double actual = getDistribution().cumulativeProbability(0.25, 0.75);
-        assertEquals(0.0905214, actual, 10e-4);
+        Assert.assertEquals(0.0905214, actual, 10e-4);
     }
 
+    @Test
     public void testDensity() {
         ExponentialDistribution d1 = new ExponentialDistributionImpl(1);
-        assertEquals(0.0, d1.density(-1e-9));
-        assertEquals(1.0, d1.density(0.0));
-        assertEquals(0.0, d1.density(1000.0));
-        assertEquals(FastMath.exp(-1), d1.density(1.0));
-        assertEquals(FastMath.exp(-2), d1.density(2.0));
+        Assert.assertTrue(MathUtils.equals(0.0, d1.density(-1e-9), 1));
+        Assert.assertTrue(MathUtils.equals(1.0, d1.density(0.0), 1));
+        Assert.assertTrue(MathUtils.equals(0.0, d1.density(1000.0), 1));
+        Assert.assertTrue(MathUtils.equals(FastMath.exp(-1), d1.density(1.0), 1));
+        Assert.assertTrue(MathUtils.equals(FastMath.exp(-2), d1.density(2.0), 1));
 
         ExponentialDistribution d2 = new ExponentialDistributionImpl(3);
-        assertEquals(1/3.0, d2.density(0.0));
+        Assert.assertTrue(MathUtils.equals(1/3.0, d2.density(0.0), 1));
         // computed using  print(dexp(1, rate=1/3), digits=10) in R 2.5
-        assertEquals(0.2388437702, d2.density(1.0), 1e-8);
+        Assert.assertEquals(0.2388437702, d2.density(1.0), 1e-8);
 
         // computed using  print(dexp(2, rate=1/3), digits=10) in R 2.5
-        assertEquals(0.1711390397, d2.density(2.0), 1e-8);
+        Assert.assertEquals(0.1711390397, d2.density(2.0), 1e-8);
     }
 
+    @Test
     public void testMeanAccessors() {
         ExponentialDistribution distribution = (ExponentialDistribution) getDistribution();
-        assertEquals(5d, distribution.getMean(), Double.MIN_VALUE);
+        Assert.assertEquals(5d, distribution.getMean(), Double.MIN_VALUE);
     }
 
+    @Test
     public void testPreconditions() {
         try {
             new ExponentialDistributionImpl(0);
-            fail("Should have generated NotStrictlyPositiveException");
+            Assert.fail("Should have generated NotStrictlyPositiveException");
         } catch (NotStrictlyPositiveException e) {
             // Expected.
         }
     }
 
+    @Test
     public void testMomonts() {
         final double tol = 1e-9;
         ExponentialDistribution dist;
         
         dist = new ExponentialDistributionImpl(11d);
-        assertEquals(dist.getNumericalMean(), 11d, tol);
-        assertEquals(dist.getNumericalVariance(), 11d * 11d, tol);
+        Assert.assertEquals(dist.getNumericalMean(), 11d, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 11d * 11d, tol);
         
         dist = new ExponentialDistributionImpl(10.5d);
-        assertEquals(dist.getNumericalMean(), 10.5d, tol);
-        assertEquals(dist.getNumericalVariance(), 10.5d * 10.5d, tol);
+        Assert.assertEquals(dist.getNumericalMean(), 10.5d, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 10.5d * 10.5d, tol);
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/FDistributionTest.java Sun Mar 20 17:24:14 2011
@@ -17,6 +17,8 @@
 package org.apache.commons.math.distribution;
 
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Test cases for FDistribution.
@@ -27,14 +29,6 @@ import org.apache.commons.math.exception
  */
 public class FDistributionTest extends ContinuousDistributionAbstractTest {
 
-    /**
-     * Constructor for FDistributionTest.
-     * @param name
-     */
-    public FDistributionTest(String name) {
-        super(name);
-    }
-
     //-------------- Implementations for abstract methods -----------------------
 
     /** Creates the default continuous distribution instance to use in tests. */
@@ -66,79 +60,86 @@ public class FDistributionTest extends C
 
     // --------------------- Override tolerance  --------------
     @Override
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         super.setUp();
         setTolerance(1e-9);
     }
 
     //---------------------------- Additional test cases -------------------------
 
+    @Test
     public void testCumulativeProbabilityExtremes() throws Exception {
         setCumulativeTestPoints(new double[] {-2, 0});
         setCumulativeTestValues(new double[] {0, 0});
         verifyCumulativeProbabilities();
     }
 
+    @Test
     public void testInverseCumulativeProbabilityExtremes() throws Exception {
         setInverseCumulativeTestPoints(new double[] {0, 1});
         setInverseCumulativeTestValues(new double[] {0, Double.POSITIVE_INFINITY});
         verifyInverseCumulativeProbabilities();
     }
 
+    @Test
     public void testDfAccessors() {
         FDistribution dist = (FDistribution) getDistribution();
-        assertEquals(5d, dist.getNumeratorDegreesOfFreedom(), Double.MIN_VALUE);
-        assertEquals(6d, dist.getDenominatorDegreesOfFreedom(), Double.MIN_VALUE);
+        Assert.assertEquals(5d, dist.getNumeratorDegreesOfFreedom(), Double.MIN_VALUE);
+        Assert.assertEquals(6d, dist.getDenominatorDegreesOfFreedom(), Double.MIN_VALUE);
     }
 
+    @Test
     public void testPreconditions() {
         try {
             new FDistributionImpl(0, 1);
-            fail("Expecting NotStrictlyPositiveException for df = 0");
+            Assert.fail("Expecting NotStrictlyPositiveException for df = 0");
         } catch (NotStrictlyPositiveException ex) {
             // Expected.
         }
         try {
             new FDistributionImpl(1, 0);
-            fail("Expecting NotStrictlyPositiveException for df = 0");
+            Assert.fail("Expecting NotStrictlyPositiveException for df = 0");
         } catch (NotStrictlyPositiveException ex) {
             // Expected.
         }
     }
 
+    @Test
     public void testLargeDegreesOfFreedom() throws Exception {
         FDistributionImpl fd = new FDistributionImpl(100000, 100000);
         double p = fd.cumulativeProbability(.999);
         double x = fd.inverseCumulativeProbability(p);
-        assertEquals(.999, x, 1.0e-5);
+        Assert.assertEquals(.999, x, 1.0e-5);
     }
 
+    @Test
     public void testSmallDegreesOfFreedom() throws Exception {
         FDistributionImpl fd = new FDistributionImpl(1, 1);
         double p = fd.cumulativeProbability(0.975);
         double x = fd.inverseCumulativeProbability(p);
-        assertEquals(0.975, x, 1.0e-5);
+        Assert.assertEquals(0.975, x, 1.0e-5);
 
         fd = new FDistributionImpl(1, 2);
         p = fd.cumulativeProbability(0.975);
         x = fd.inverseCumulativeProbability(p);
-        assertEquals(0.975, x, 1.0e-5);
+        Assert.assertEquals(0.975, x, 1.0e-5);
     }
 
+    @Test
     public void testMomonts() {
         final double tol = 1e-9;
         FDistribution dist;
         
         dist = new FDistributionImpl(1, 2);
-        assertTrue(Double.isNaN(dist.getNumericalMean()));
-        assertTrue(Double.isNaN(dist.getNumericalVariance()));
+        Assert.assertTrue(Double.isNaN(dist.getNumericalMean()));
+        Assert.assertTrue(Double.isNaN(dist.getNumericalVariance()));
         
         dist = new FDistributionImpl(1, 3);
-        assertEquals(dist.getNumericalMean(), 3d / (3d - 2d), tol);
-        assertTrue(Double.isNaN(dist.getNumericalVariance()));
+        Assert.assertEquals(dist.getNumericalMean(), 3d / (3d - 2d), tol);
+        Assert.assertTrue(Double.isNaN(dist.getNumericalVariance()));
         
         dist = new FDistributionImpl(1, 5);
-        assertEquals(dist.getNumericalMean(), 5d / (5d - 2d), tol);
-        assertEquals(dist.getNumericalVariance(), (2d * 5d * 5d * 4d) / 9d, tol);        
+        Assert.assertEquals(dist.getNumericalMean(), 5d / (5d - 2d), tol);
+        Assert.assertEquals(dist.getNumericalVariance(), (2d * 5d * 5d * 4d) / 9d, tol);        
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/GammaDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/GammaDistributionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/GammaDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/GammaDistributionTest.java Sun Mar 20 17:24:14 2011
@@ -18,6 +18,8 @@
 package org.apache.commons.math.distribution;
 
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Test cases for GammaDistribution.
@@ -28,14 +30,6 @@ import org.apache.commons.math.exception
  */
 public class GammaDistributionTest extends ContinuousDistributionAbstractTest {
 
-    /**
-     * Constructor for GammaDistributionTest.
-     * @param name
-     */
-    public GammaDistributionTest(String name) {
-        super(name);
-    }
-
     //-------------- Implementations for abstract methods -----------------------
 
     /** Creates the default continuous distribution instance to use in tests. */
@@ -67,33 +61,36 @@ public class GammaDistributionTest exten
 
     // --------------------- Override tolerance  --------------
     @Override
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         super.setUp();
         setTolerance(1e-9);
     }
 
     //---------------------------- Additional test cases -------------------------
+    @Test
     public void testParameterAccessors() {
         GammaDistribution distribution = (GammaDistribution) getDistribution();
-        assertEquals(4d, distribution.getAlpha(), 0);
-        assertEquals(2d, distribution.getBeta(), 0);
+        Assert.assertEquals(4d, distribution.getAlpha(), 0);
+        Assert.assertEquals(2d, distribution.getBeta(), 0);
     }
 
+    @Test
     public void testPreconditions() {
         try {
             new GammaDistributionImpl(0, 1);
-            fail("Expecting NotStrictlyPositiveException for alpha = 0");
+            Assert.fail("Expecting NotStrictlyPositiveException for alpha = 0");
         } catch (NotStrictlyPositiveException ex) {
             // Expected.
         }
         try {
             new GammaDistributionImpl(1, 0);
-            fail("Expecting NotStrictlyPositiveException for alpha = 0");
+            Assert.fail("Expecting NotStrictlyPositiveException for alpha = 0");
         } catch (NotStrictlyPositiveException ex) {
             // Expected.
         }
     }
 
+    @Test
     public void testProbabilities() throws Exception {
         testProbability(-1.000, 4.0, 2.0, .0000);
         testProbability(15.501, 4.0, 2.0, .9499);
@@ -102,6 +99,7 @@ public class GammaDistributionTest exten
         testProbability(5.000, 2.0, 2.0, .7127);
     }
 
+    @Test
     public void testValues() throws Exception {
         testValue(15.501, 4.0, 2.0, .9499);
         testValue(0.504, 4.0, 1.0, .0018);
@@ -112,15 +110,16 @@ public class GammaDistributionTest exten
     private void testProbability(double x, double a, double b, double expected) throws Exception {
         GammaDistribution distribution = new GammaDistributionImpl( a, b );
         double actual = distribution.cumulativeProbability(x);
-        assertEquals("probability for " + x, expected, actual, 10e-4);
+        Assert.assertEquals("probability for " + x, expected, actual, 10e-4);
     }
 
     private void testValue(double expected, double a, double b, double p) throws Exception {
         GammaDistribution distribution = new GammaDistributionImpl( a, b );
         double actual = distribution.inverseCumulativeProbability(p);
-        assertEquals("critical value for " + p, expected, actual, 10e-4);
+        Assert.assertEquals("critical value for " + p, expected, actual, 10e-4);
     }
 
+    @Test
     public void testDensity() {
         double[] x = new double[]{-0.1, 1e-6, 0.5, 1, 2, 5};
         // R2.5: print(dgamma(x, shape=1, rate=1), digits=10)
@@ -144,26 +143,28 @@ public class GammaDistributionTest exten
     private void checkDensity(double alpha, double rate, double[] x, double[] expected) {
         GammaDistribution d = new GammaDistributionImpl(alpha, 1 / rate);
         for (int i = 0; i < x.length; i++) {
-            assertEquals(expected[i], d.density(x[i]), 1e-5);
+            Assert.assertEquals(expected[i], d.density(x[i]), 1e-5);
         }
     }
 
+    @Test
     public void testInverseCumulativeProbabilityExtremes() throws Exception {
         setInverseCumulativeTestPoints(new double[] {0, 1});
         setInverseCumulativeTestValues(new double[] {0, Double.POSITIVE_INFINITY});
         verifyInverseCumulativeProbabilities();
     }
 
+    @Test
     public void testMomonts() {
         final double tol = 1e-9;
         GammaDistribution dist;
         
         dist = new GammaDistributionImpl(1, 2);
-        assertEquals(dist.getNumericalMean(), 2, tol);
-        assertEquals(dist.getNumericalVariance(), 4, tol); 
+        Assert.assertEquals(dist.getNumericalMean(), 2, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 4, tol); 
         
         dist = new GammaDistributionImpl(1.1, 4.2);
-        assertEquals(dist.getNumericalMean(), 1.1d * 4.2d, tol);
-        assertEquals(dist.getNumericalVariance(), 1.1d * 4.2d * 4.2d, tol);
+        Assert.assertEquals(dist.getNumericalMean(), 1.1d * 4.2d, tol);
+        Assert.assertEquals(dist.getNumericalVariance(), 1.1d * 4.2d * 4.2d, tol);
     }
 }



Mime
View raw message