commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1083514 [4/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/fraction/BigFractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java?rev=1083514&r1=1083513&r2=1083514&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 Sun Mar 20 17:24:14 2011
@@ -23,21 +23,23 @@ import org.apache.commons.math.Convergen
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.util.FastMath;
+import org.junit.Assert;
+import org.junit.Test;
 
-import junit.framework.TestCase;
 
-public class BigFractionTest extends TestCase {
+public class BigFractionTest {
 
     private void assertFraction(int expectedNumerator, int expectedDenominator, BigFraction actual) {
-        assertEquals(expectedNumerator, actual.getNumeratorAsInt());
-        assertEquals(expectedDenominator, actual.getDenominatorAsInt());
+        Assert.assertEquals(expectedNumerator, actual.getNumeratorAsInt());
+        Assert.assertEquals(expectedDenominator, actual.getDenominatorAsInt());
     }
 
     private void assertFraction(long expectedNumerator, long expectedDenominator, BigFraction actual) {
-        assertEquals(expectedNumerator, actual.getNumeratorAsLong());
-        assertEquals(expectedDenominator, actual.getDenominatorAsLong());
+        Assert.assertEquals(expectedNumerator, actual.getNumeratorAsLong());
+        Assert.assertEquals(expectedDenominator, actual.getDenominatorAsLong());
     }
 
+    @Test
     public void testConstructor() throws Exception {
         assertFraction(0, 1, new BigFraction(0, 1));
         assertFraction(0, 1, new BigFraction(0l, 2l));
@@ -56,49 +58,51 @@ public class BigFractionTest extends Tes
         assertFraction(2, 5, new BigFraction(0.40000000000001, 1.0e-5, 100));
         assertFraction(15, 1, new BigFraction(15.0000000000001, 1.0e-5, 100));
 
-        assertEquals(0.00000000000001, new BigFraction(0.00000000000001).doubleValue(), 0.0);
-        assertEquals(0.40000000000001, new BigFraction(0.40000000000001).doubleValue(), 0.0);
-        assertEquals(15.0000000000001, new BigFraction(15.0000000000001).doubleValue(), 0.0);
+        Assert.assertEquals(0.00000000000001, new BigFraction(0.00000000000001).doubleValue(), 0.0);
+        Assert.assertEquals(0.40000000000001, new BigFraction(0.40000000000001).doubleValue(), 0.0);
+        Assert.assertEquals(15.0000000000001, new BigFraction(15.0000000000001).doubleValue(), 0.0);
         assertFraction(3602879701896487l, 9007199254740992l, new BigFraction(0.40000000000001));
         assertFraction(1055531162664967l, 70368744177664l, new BigFraction(15.0000000000001));
         try {
             new BigFraction(null, BigInteger.ONE);
-            fail("Expecting NullArgumentException");
+            Assert.fail("Expecting NullArgumentException");
         } catch (NullArgumentException npe) {
             // expected
         }
         try {
             new BigFraction(BigInteger.ONE, null);
-            fail("Expecting NullArgumentException");
+            Assert.fail("Expecting NullArgumentException");
         } catch (NullArgumentException npe) {
             // expected
         }
         try {
             new BigFraction(BigInteger.ONE, BigInteger.ZERO);
-            fail("Expecting ArithmeticException");
+            Assert.fail("Expecting ArithmeticException");
         } catch (ArithmeticException npe) {
             // expected
         }
         try {
             new BigFraction(2.0 * Integer.MAX_VALUE, 1.0e-5, 100000);
-            fail("Expecting FractionConversionException");
+            Assert.fail("Expecting FractionConversionException");
         } catch (FractionConversionException fce) {
             // expected
         }
     }
 
+    @Test
     public void testGoldenRatio() {
         try {
             // the golden ratio is notoriously a difficult number for continuous
             // fraction
             new BigFraction((1 + FastMath.sqrt(5)) / 2, 1.0e-12, 25);
-            fail("an exception should have been thrown");
+            Assert.fail("an exception should have been thrown");
         } catch (ConvergenceException ce) {
             // expected behavior
         }
     }
 
     // MATH-179
+    @Test
     public void testDoubleConstructor() throws ConvergenceException {
         assertFraction(1, 2, new BigFraction((double) 1 / (double) 2, 1.0e-5, 100));
         assertFraction(1, 3, new BigFraction((double) 1 / (double) 3, 1.0e-5, 100));
@@ -144,6 +148,7 @@ public class BigFractionTest extends Tes
     }
 
     // MATH-181
+    @Test
     public void testDigitLimitConstructor() throws ConvergenceException {
         assertFraction(2, 5, new BigFraction(0.4, 9));
         assertFraction(2, 5, new BigFraction(0.4, 99));
@@ -155,6 +160,7 @@ public class BigFractionTest extends Tes
         assertFraction(769, 1250, new BigFraction(0.6152, 9999));
     }
 
+    @Test
     public void testEpsilonLimitConstructor() throws ConvergenceException {
         assertFraction(2, 5, new BigFraction(0.4, 1.0e-5, 100));
 
@@ -166,59 +172,65 @@ public class BigFractionTest extends Tes
         assertFraction(769, 1250, new BigFraction(0.6152, 1.0e-7, 100));
     }
 
+    @Test
     public void testCompareTo() {
         BigFraction first = new BigFraction(1, 2);
         BigFraction second = new BigFraction(1, 3);
         BigFraction third = new BigFraction(1, 2);
 
-        assertEquals(0, first.compareTo(first));
-        assertEquals(0, first.compareTo(third));
-        assertEquals(1, first.compareTo(second));
-        assertEquals(-1, second.compareTo(first));
+        Assert.assertEquals(0, first.compareTo(first));
+        Assert.assertEquals(0, first.compareTo(third));
+        Assert.assertEquals(1, first.compareTo(second));
+        Assert.assertEquals(-1, second.compareTo(first));
 
         // these two values are different approximations of PI
         // the first  one is approximately PI - 3.07e-18
         // the second one is approximately PI + 1.936e-17
         BigFraction pi1 = new BigFraction(1068966896, 340262731);
         BigFraction pi2 = new BigFraction( 411557987, 131002976);
-        assertEquals(-1, pi1.compareTo(pi2));
-        assertEquals( 1, pi2.compareTo(pi1));
-        assertEquals(0.0, pi1.doubleValue() - pi2.doubleValue(), 1.0e-20);
+        Assert.assertEquals(-1, pi1.compareTo(pi2));
+        Assert.assertEquals( 1, pi2.compareTo(pi1));
+        Assert.assertEquals(0.0, pi1.doubleValue() - pi2.doubleValue(), 1.0e-20);
 
     }
 
+    @Test
     public void testDoubleValue() {
         BigFraction first = new BigFraction(1, 2);
         BigFraction second = new BigFraction(1, 3);
 
-        assertEquals(0.5, first.doubleValue(), 0.0);
-        assertEquals(1.0 / 3.0, second.doubleValue(), 0.0);
+        Assert.assertEquals(0.5, first.doubleValue(), 0.0);
+        Assert.assertEquals(1.0 / 3.0, second.doubleValue(), 0.0);
     }
 
+    @Test
     public void testFloatValue() {
         BigFraction first = new BigFraction(1, 2);
         BigFraction second = new BigFraction(1, 3);
 
-        assertEquals(0.5f, first.floatValue(), 0.0f);
-        assertEquals((float) (1.0 / 3.0), second.floatValue(), 0.0f);
+        Assert.assertEquals(0.5f, first.floatValue(), 0.0f);
+        Assert.assertEquals((float) (1.0 / 3.0), second.floatValue(), 0.0f);
     }
 
+    @Test
     public void testIntValue() {
         BigFraction first = new BigFraction(1, 2);
         BigFraction second = new BigFraction(3, 2);
 
-        assertEquals(0, first.intValue());
-        assertEquals(1, second.intValue());
+        Assert.assertEquals(0, first.intValue());
+        Assert.assertEquals(1, second.intValue());
     }
 
+    @Test
     public void testLongValue() {
         BigFraction first = new BigFraction(1, 2);
         BigFraction second = new BigFraction(3, 2);
 
-        assertEquals(0L, first.longValue());
-        assertEquals(1L, second.longValue());
+        Assert.assertEquals(0L, first.longValue());
+        Assert.assertEquals(1L, second.longValue());
     }
 
+    @Test
     public void testConstructorDouble() {
         assertFraction(1, 2, new BigFraction(0.5));
         assertFraction(6004799503160661l, 18014398509481984l, new BigFraction(1.0 / 3.0));
@@ -231,16 +243,17 @@ public class BigFractionTest extends Tes
         for (double v : new double[] { Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY}) {
             try {
                 new BigFraction(v);
-                fail("Expecting IllegalArgumentException");
+                Assert.fail("Expecting IllegalArgumentException");
             } catch (IllegalArgumentException iae) {
                 // expected
             }
         }
-        assertEquals(1l, new BigFraction(Double.MAX_VALUE).getDenominatorAsLong());
-        assertEquals(1l, new BigFraction(Double.longBitsToDouble(0x0010000000000000L)).getNumeratorAsLong());
-        assertEquals(1l, new BigFraction(Double.MIN_VALUE).getNumeratorAsLong());
+        Assert.assertEquals(1l, new BigFraction(Double.MAX_VALUE).getDenominatorAsLong());
+        Assert.assertEquals(1l, new BigFraction(Double.longBitsToDouble(0x0010000000000000L)).getNumeratorAsLong());
+        Assert.assertEquals(1l, new BigFraction(Double.MIN_VALUE).getNumeratorAsLong());
     }
 
+    @Test
     public void testAbs() {
         BigFraction a = new BigFraction(10, 21);
         BigFraction b = new BigFraction(-10, 21);
@@ -251,59 +264,62 @@ public class BigFractionTest extends Tes
         assertFraction(10, 21, c.abs());
     }
 
+    @Test
     public void testReciprocal() {
         BigFraction f = null;
 
         f = new BigFraction(50, 75);
         f = f.reciprocal();
-        assertEquals(3, f.getNumeratorAsInt());
-        assertEquals(2, f.getDenominatorAsInt());
+        Assert.assertEquals(3, f.getNumeratorAsInt());
+        Assert.assertEquals(2, f.getDenominatorAsInt());
 
         f = new BigFraction(4, 3);
         f = f.reciprocal();
-        assertEquals(3, f.getNumeratorAsInt());
-        assertEquals(4, f.getDenominatorAsInt());
+        Assert.assertEquals(3, f.getNumeratorAsInt());
+        Assert.assertEquals(4, f.getDenominatorAsInt());
 
         f = new BigFraction(-15, 47);
         f = f.reciprocal();
-        assertEquals(-47, f.getNumeratorAsInt());
-        assertEquals(15, f.getDenominatorAsInt());
+        Assert.assertEquals(-47, f.getNumeratorAsInt());
+        Assert.assertEquals(15, f.getDenominatorAsInt());
 
         f = new BigFraction(0, 3);
         try {
             f = f.reciprocal();
-            fail("expecting ArithmeticException");
+            Assert.fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {
         }
 
         // large values
         f = new BigFraction(Integer.MAX_VALUE, 1);
         f = f.reciprocal();
-        assertEquals(1, f.getNumeratorAsInt());
-        assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
+        Assert.assertEquals(1, f.getNumeratorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
     }
 
+    @Test
     public void testNegate() {
         BigFraction f = null;
 
         f = new BigFraction(50, 75);
         f = f.negate();
-        assertEquals(-2, f.getNumeratorAsInt());
-        assertEquals(3, f.getDenominatorAsInt());
+        Assert.assertEquals(-2, f.getNumeratorAsInt());
+        Assert.assertEquals(3, f.getDenominatorAsInt());
 
         f = new BigFraction(-50, 75);
         f = f.negate();
-        assertEquals(2, f.getNumeratorAsInt());
-        assertEquals(3, f.getDenominatorAsInt());
+        Assert.assertEquals(2, f.getNumeratorAsInt());
+        Assert.assertEquals(3, f.getDenominatorAsInt());
 
         // large values
         f = new BigFraction(Integer.MAX_VALUE - 1, Integer.MAX_VALUE);
         f = f.negate();
-        assertEquals(Integer.MIN_VALUE + 2, f.getNumeratorAsInt());
-        assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MIN_VALUE + 2, f.getNumeratorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
 
     }
 
+    @Test
     public void testAdd() {
         BigFraction a = new BigFraction(1, 2);
         BigFraction b = new BigFraction(2, 3);
@@ -316,18 +332,18 @@ public class BigFractionTest extends Tes
         BigFraction f1 = new BigFraction(Integer.MAX_VALUE - 1, 1);
         BigFraction f2 = BigFraction.ONE;
         BigFraction f = f1.add(f2);
-        assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f1 = new BigFraction(-1, 13 * 13 * 2 * 2);
         f2 = new BigFraction(-2, 13 * 17 * 2);
         f = f1.add(f2);
-        assertEquals(13 * 13 * 17 * 2 * 2, f.getDenominatorAsInt());
-        assertEquals(-17 - 2 * 13 * 2, f.getNumeratorAsInt());
+        Assert.assertEquals(13 * 13 * 17 * 2 * 2, f.getDenominatorAsInt());
+        Assert.assertEquals(-17 - 2 * 13 * 2, f.getNumeratorAsInt());
 
         try {
             f.add((BigFraction) null);
-            fail("expecting NullArgumentException");
+            Assert.fail("expecting NullArgumentException");
         } catch (NullArgumentException ex) {
         }
 
@@ -336,44 +352,45 @@ public class BigFractionTest extends Tes
         f1 = new BigFraction(1, 32768 * 3);
         f2 = new BigFraction(1, 59049);
         f = f1.add(f2);
-        assertEquals(52451, f.getNumeratorAsInt());
-        assertEquals(1934917632, f.getDenominatorAsInt());
+        Assert.assertEquals(52451, f.getNumeratorAsInt());
+        Assert.assertEquals(1934917632, f.getDenominatorAsInt());
 
         f1 = new BigFraction(Integer.MIN_VALUE, 3);
         f2 = new BigFraction(1, 3);
         f = f1.add(f2);
-        assertEquals(Integer.MIN_VALUE + 1, f.getNumeratorAsInt());
-        assertEquals(3, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MIN_VALUE + 1, f.getNumeratorAsInt());
+        Assert.assertEquals(3, f.getDenominatorAsInt());
 
         f1 = new BigFraction(Integer.MAX_VALUE - 1, 1);
         f = f1.add(BigInteger.ONE);
-        assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f = f.add(BigInteger.ZERO);
-        assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f1 = new BigFraction(Integer.MAX_VALUE - 1, 1);
         f = f1.add(1);
-        assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f = f.add(0);
-        assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f1 = new BigFraction(Integer.MAX_VALUE - 1, 1);
         f = f1.add(1l);
-        assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f = f.add(0l);
-        assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
     }
 
+    @Test
     public void testDivide() {
         BigFraction a = new BigFraction(1, 2);
         BigFraction b = new BigFraction(2, 3);
@@ -387,55 +404,56 @@ public class BigFractionTest extends Tes
         BigFraction f2 = BigFraction.ZERO;
         try {
             f1.divide(f2);
-            fail("expecting ArithmeticException");
+            Assert.fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {
         }
 
         f1 = new BigFraction(0, 5);
         f2 = new BigFraction(2, 7);
         BigFraction f = f1.divide(f2);
-        assertSame(BigFraction.ZERO, f);
+        Assert.assertSame(BigFraction.ZERO, f);
 
         f1 = new BigFraction(2, 7);
         f2 = BigFraction.ONE;
         f = f1.divide(f2);
-        assertEquals(2, f.getNumeratorAsInt());
-        assertEquals(7, f.getDenominatorAsInt());
+        Assert.assertEquals(2, f.getNumeratorAsInt());
+        Assert.assertEquals(7, f.getDenominatorAsInt());
 
         f1 = new BigFraction(1, Integer.MAX_VALUE);
         f = f1.divide(f1);
-        assertEquals(1, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(1, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f1 = new BigFraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         f2 = new BigFraction(1, Integer.MAX_VALUE);
         f = f1.divide(f2);
-        assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         try {
             f.divide((BigFraction) null);
-            fail("expecting NullArgumentException");
+            Assert.fail("expecting NullArgumentException");
         } catch (NullArgumentException ex) {
         }
 
         f1 = new BigFraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         f = f1.divide(BigInteger.valueOf(Integer.MIN_VALUE));
-        assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
-        assertEquals(1, f.getNumeratorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
+        Assert.assertEquals(1, f.getNumeratorAsInt());
 
         f1 = new BigFraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         f = f1.divide(Integer.MIN_VALUE);
-        assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
-        assertEquals(1, f.getNumeratorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
+        Assert.assertEquals(1, f.getNumeratorAsInt());
 
         f1 = new BigFraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         f = f1.divide((long) Integer.MIN_VALUE);
-        assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
-        assertEquals(1, f.getNumeratorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getDenominatorAsInt());
+        Assert.assertEquals(1, f.getNumeratorAsInt());
 
     }
 
+    @Test
     public void testMultiply() {
         BigFraction a = new BigFraction(1, 2);
         BigFraction b = new BigFraction(2, 3);
@@ -448,25 +466,26 @@ public class BigFractionTest extends Tes
         BigFraction f1 = new BigFraction(Integer.MAX_VALUE, 1);
         BigFraction f2 = new BigFraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         BigFraction f = f1.multiply(f2);
-        assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f = f2.multiply(Integer.MAX_VALUE);
-        assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         f = f2.multiply((long) Integer.MAX_VALUE);
-        assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MIN_VALUE, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
         try {
             f.multiply((BigFraction) null);
-            fail("expecting NullArgumentException");
+            Assert.fail("expecting NullArgumentException");
         } catch (NullArgumentException ex) {
         }
 
     }
 
+    @Test
     public void testSubtract() {
         BigFraction a = new BigFraction(1, 2);
         BigFraction b = new BigFraction(2, 3);
@@ -479,7 +498,7 @@ public class BigFractionTest extends Tes
         BigFraction f = new BigFraction(1, 1);
         try {
             f.subtract((BigFraction) null);
-            fail("expecting NullArgumentException");
+            Assert.fail("expecting NullArgumentException");
         } catch (NullArgumentException ex) {
         }
 
@@ -488,79 +507,85 @@ public class BigFractionTest extends Tes
         BigFraction f1 = new BigFraction(1, 32768 * 3);
         BigFraction f2 = new BigFraction(1, 59049);
         f = f1.subtract(f2);
-        assertEquals(-13085, f.getNumeratorAsInt());
-        assertEquals(1934917632, f.getDenominatorAsInt());
+        Assert.assertEquals(-13085, f.getNumeratorAsInt());
+        Assert.assertEquals(1934917632, f.getDenominatorAsInt());
 
         f1 = new BigFraction(Integer.MIN_VALUE, 3);
         f2 = new BigFraction(1, 3).negate();
         f = f1.subtract(f2);
-        assertEquals(Integer.MIN_VALUE + 1, f.getNumeratorAsInt());
-        assertEquals(3, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MIN_VALUE + 1, f.getNumeratorAsInt());
+        Assert.assertEquals(3, f.getDenominatorAsInt());
 
         f1 = new BigFraction(Integer.MAX_VALUE, 1);
         f2 = BigFraction.ONE;
         f = f1.subtract(f2);
-        assertEquals(Integer.MAX_VALUE - 1, f.getNumeratorAsInt());
-        assertEquals(1, f.getDenominatorAsInt());
+        Assert.assertEquals(Integer.MAX_VALUE - 1, f.getNumeratorAsInt());
+        Assert.assertEquals(1, f.getDenominatorAsInt());
 
     }
 
+    @Test
     public void testBigDecimalValue() {
-        assertEquals(new BigDecimal(0.5), new BigFraction(1, 2).bigDecimalValue());
-        assertEquals(new BigDecimal("0.0003"), new BigFraction(3, 10000).bigDecimalValue());
-        assertEquals(new BigDecimal("0"), new BigFraction(1, 3).bigDecimalValue(BigDecimal.ROUND_DOWN));
-        assertEquals(new BigDecimal("0.333"), new BigFraction(1, 3).bigDecimalValue(3, BigDecimal.ROUND_DOWN));
+        Assert.assertEquals(new BigDecimal(0.5), new BigFraction(1, 2).bigDecimalValue());
+        Assert.assertEquals(new BigDecimal("0.0003"), new BigFraction(3, 10000).bigDecimalValue());
+        Assert.assertEquals(new BigDecimal("0"), new BigFraction(1, 3).bigDecimalValue(BigDecimal.ROUND_DOWN));
+        Assert.assertEquals(new BigDecimal("0.333"), new BigFraction(1, 3).bigDecimalValue(3, BigDecimal.ROUND_DOWN));
     }
 
+    @Test
     public void testEqualsAndHashCode() {
         BigFraction zero = new BigFraction(0, 1);
         BigFraction nullFraction = null;
-        assertTrue(zero.equals(zero));
-        assertFalse(zero.equals(nullFraction));
-        assertFalse(zero.equals(Double.valueOf(0)));
+        Assert.assertTrue(zero.equals(zero));
+        Assert.assertFalse(zero.equals(nullFraction));
+        Assert.assertFalse(zero.equals(Double.valueOf(0)));
         BigFraction zero2 = new BigFraction(0, 2);
-        assertTrue(zero.equals(zero2));
-        assertEquals(zero.hashCode(), zero2.hashCode());
+        Assert.assertTrue(zero.equals(zero2));
+        Assert.assertEquals(zero.hashCode(), zero2.hashCode());
         BigFraction one = new BigFraction(1, 1);
-        assertFalse((one.equals(zero) || zero.equals(one)));
-        assertTrue(one.equals(BigFraction.ONE));
+        Assert.assertFalse((one.equals(zero) || zero.equals(one)));
+        Assert.assertTrue(one.equals(BigFraction.ONE));
     }
 
+    @Test
     public void testGetReducedFraction() {
         BigFraction threeFourths = new BigFraction(3, 4);
-        assertTrue(threeFourths.equals(BigFraction.getReducedFraction(6, 8)));
-        assertTrue(BigFraction.ZERO.equals(BigFraction.getReducedFraction(0, -1)));
+        Assert.assertTrue(threeFourths.equals(BigFraction.getReducedFraction(6, 8)));
+        Assert.assertTrue(BigFraction.ZERO.equals(BigFraction.getReducedFraction(0, -1)));
         try {
             BigFraction.getReducedFraction(1, 0);
-            fail("expecting ArithmeticException");
+            Assert.fail("expecting ArithmeticException");
         } catch (ArithmeticException ex) {
             // expected
         }
-        assertEquals(BigFraction.getReducedFraction(2, Integer.MIN_VALUE).getNumeratorAsInt(), -1);
-        assertEquals(BigFraction.getReducedFraction(1, -1).getNumeratorAsInt(), -1);
+        Assert.assertEquals(BigFraction.getReducedFraction(2, Integer.MIN_VALUE).getNumeratorAsInt(), -1);
+        Assert.assertEquals(BigFraction.getReducedFraction(1, -1).getNumeratorAsInt(), -1);
     }
 
+    @Test
     public void testPow() {
-        assertEquals(new BigFraction(8192, 1594323), new BigFraction(2, 3).pow(13));
-        assertEquals(new BigFraction(8192, 1594323), new BigFraction(2, 3).pow(13l));
-        assertEquals(new BigFraction(8192, 1594323), new BigFraction(2, 3).pow(BigInteger.valueOf(13l)));
-        assertEquals(BigFraction.ONE, new BigFraction(2, 3).pow(0));
-        assertEquals(BigFraction.ONE, new BigFraction(2, 3).pow(0l));
-        assertEquals(BigFraction.ONE, new BigFraction(2, 3).pow(BigInteger.valueOf(0l)));
-        assertEquals(new BigFraction(1594323, 8192), new BigFraction(2, 3).pow(-13));
-        assertEquals(new BigFraction(1594323, 8192), new BigFraction(2, 3).pow(-13l));
-        assertEquals(new BigFraction(1594323, 8192), new BigFraction(2, 3).pow(BigInteger.valueOf(-13l)));
+        Assert.assertEquals(new BigFraction(8192, 1594323), new BigFraction(2, 3).pow(13));
+        Assert.assertEquals(new BigFraction(8192, 1594323), new BigFraction(2, 3).pow(13l));
+        Assert.assertEquals(new BigFraction(8192, 1594323), new BigFraction(2, 3).pow(BigInteger.valueOf(13l)));
+        Assert.assertEquals(BigFraction.ONE, new BigFraction(2, 3).pow(0));
+        Assert.assertEquals(BigFraction.ONE, new BigFraction(2, 3).pow(0l));
+        Assert.assertEquals(BigFraction.ONE, new BigFraction(2, 3).pow(BigInteger.valueOf(0l)));
+        Assert.assertEquals(new BigFraction(1594323, 8192), new BigFraction(2, 3).pow(-13));
+        Assert.assertEquals(new BigFraction(1594323, 8192), new BigFraction(2, 3).pow(-13l));
+        Assert.assertEquals(new BigFraction(1594323, 8192), new BigFraction(2, 3).pow(BigInteger.valueOf(-13l)));
     }
 
+    @Test
     public void testMath340() {
         BigFraction fractionA = new BigFraction(0.00131);
         BigFraction fractionB = new BigFraction(.37).reciprocal();
         BigFraction errorResult = fractionA.multiply(fractionB);
         BigFraction correctResult = new BigFraction(fractionA.getNumerator().multiply(fractionB.getNumerator()),
                                                     fractionA.getDenominator().multiply(fractionB.getDenominator()));
-        assertEquals(correctResult, errorResult);
+        Assert.assertEquals(correctResult, errorResult);
     }
 
+    @Test
     public void testSerial() throws FractionConversionException {
         BigFraction[] fractions = {
             new BigFraction(3, 4), BigFraction.ONE, BigFraction.ZERO,
@@ -568,7 +593,7 @@ public class BigFractionTest extends Tes
             new BigFraction(-5, 2)
         };
         for (BigFraction fraction : fractions) {
-            assertEquals(fraction, TestUtils.serializeAndRecover(fraction));
+            Assert.assertEquals(fraction, TestUtils.serializeAndRecover(fraction));
         }
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFieldTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFieldTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFieldTest.java Sun Mar 20 17:24:14 2011
@@ -16,29 +16,28 @@
  */
 package org.apache.commons.math.fraction;
 
-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 FractionFieldTest {
 
     @Test
     public void testZero() {
-        assertEquals(Fraction.ZERO, FractionField.getInstance().getZero());
+        Assert.assertEquals(Fraction.ZERO, FractionField.getInstance().getZero());
     }
 
     @Test
     public void testOne() {
-        assertEquals(Fraction.ONE, FractionField.getInstance().getOne());
+        Assert.assertEquals(Fraction.ONE, FractionField.getInstance().getOne());
     }
 
     @Test
     public void testSerial() {
         // deserializing the singleton should give the singleton itself back
         FractionField field = FractionField.getInstance();
-        assertTrue(field == TestUtils.serializeAndRecover(field));
+        Assert.assertTrue(field == TestUtils.serializeAndRecover(field));
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionFormatTest.java Sun Mar 20 17:24:14 2011
@@ -22,10 +22,12 @@ import java.text.ParseException;
 import java.util.Locale;
 
 import org.apache.commons.math.util.FastMath;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
-import junit.framework.TestCase;
 
-public class FractionFormatTest extends TestCase {
+public class FractionFormatTest {
 
     FractionFormat properFormat = null;
     FractionFormat improperFormat = null;
@@ -34,254 +36,270 @@ public class FractionFormatTest extends 
         return Locale.getDefault();
     }
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         properFormat = FractionFormat.getProperInstance(getLocale());
         improperFormat = FractionFormat.getImproperInstance(getLocale());
     }
 
+    @Test
     public void testFormat() {
         Fraction c = new Fraction(1, 2);
         String expected = "1 / 2";
 
         String actual = properFormat.format(c);
-        assertEquals(expected, actual);
+        Assert.assertEquals(expected, actual);
 
         actual = improperFormat.format(c);
-        assertEquals(expected, actual);
+        Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testFormatNegative() {
         Fraction c = new Fraction(-1, 2);
         String expected = "-1 / 2";
 
         String actual = properFormat.format(c);
-        assertEquals(expected, actual);
+        Assert.assertEquals(expected, actual);
 
         actual = improperFormat.format(c);
-        assertEquals(expected, actual);
+        Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testFormatZero() {
         Fraction c = new Fraction(0, 1);
         String expected = "0 / 1";
 
         String actual = properFormat.format(c);
-        assertEquals(expected, actual);
+        Assert.assertEquals(expected, actual);
 
         actual = improperFormat.format(c);
-        assertEquals(expected, actual);
+        Assert.assertEquals(expected, actual);
     }
 
+    @Test
     public void testFormatImproper() {
         Fraction c = new Fraction(5, 3);
 
         String actual = properFormat.format(c);
-        assertEquals("1 2 / 3", actual);
+        Assert.assertEquals("1 2 / 3", actual);
 
         actual = improperFormat.format(c);
-        assertEquals("5 / 3", actual);
+        Assert.assertEquals("5 / 3", actual);
     }
 
+    @Test
     public void testFormatImproperNegative() {
         Fraction c = new Fraction(-5, 3);
 
         String actual = properFormat.format(c);
-        assertEquals("-1 2 / 3", actual);
+        Assert.assertEquals("-1 2 / 3", actual);
 
         actual = improperFormat.format(c);
-        assertEquals("-5 / 3", actual);
+        Assert.assertEquals("-5 / 3", actual);
     }
 
+    @Test
     public void testParse() {
         String source = "1 / 2";
 
         try {
             Fraction c = properFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(1, c.getNumerator());
-            assertEquals(2, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(1, c.getNumerator());
+            Assert.assertEquals(2, c.getDenominator());
 
             c = improperFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(1, c.getNumerator());
-            assertEquals(2, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(1, c.getNumerator());
+            Assert.assertEquals(2, c.getDenominator());
         } catch (ParseException ex) {
-            fail(ex.getMessage());
+            Assert.fail(ex.getMessage());
         }
     }
 
+    @Test
     public void testParseInteger() {
         String source = "10";
         try {
             Fraction c = properFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(10, c.getNumerator());
-            assertEquals(1, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(10, c.getNumerator());
+            Assert.assertEquals(1, c.getDenominator());
         } catch (ParseException ex) {
-            fail(ex.getMessage());
+            Assert.fail(ex.getMessage());
         }
         try {
             Fraction c = improperFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(10, c.getNumerator());
-            assertEquals(1, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(10, c.getNumerator());
+            Assert.assertEquals(1, c.getDenominator());
         } catch (ParseException ex) {
-            fail(ex.getMessage());
+            Assert.fail(ex.getMessage());
         }
     }
 
+    @Test
     public void testParseInvalid() {
         String source = "a";
         String msg = "should not be able to parse '10 / a'.";
         try {
             properFormat.parse(source);
-            fail(msg);
+            Assert.fail(msg);
         } catch (ParseException ex) {
             // success
         }
         try {
             improperFormat.parse(source);
-            fail(msg);
+            Assert.fail(msg);
         } catch (ParseException ex) {
             // success
         }
     }
 
+    @Test
     public void testParseInvalidDenominator() {
         String source = "10 / a";
         String msg = "should not be able to parse '10 / a'.";
         try {
             properFormat.parse(source);
-            fail(msg);
+            Assert.fail(msg);
         } catch (ParseException ex) {
             // success
         }
         try {
             improperFormat.parse(source);
-            fail(msg);
+            Assert.fail(msg);
         } catch (ParseException ex) {
             // success
         }
     }
 
+    @Test
     public void testParseNegative() {
 
         try {
             String source = "-1 / 2";
             Fraction c = properFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(-1, c.getNumerator());
-            assertEquals(2, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(-1, c.getNumerator());
+            Assert.assertEquals(2, c.getDenominator());
 
             c = improperFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(-1, c.getNumerator());
-            assertEquals(2, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(-1, c.getNumerator());
+            Assert.assertEquals(2, c.getDenominator());
 
             source = "1 / -2";
             c = properFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(-1, c.getNumerator());
-            assertEquals(2, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(-1, c.getNumerator());
+            Assert.assertEquals(2, c.getDenominator());
 
             c = improperFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(-1, c.getNumerator());
-            assertEquals(2, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(-1, c.getNumerator());
+            Assert.assertEquals(2, c.getDenominator());
         } catch (ParseException ex) {
-            fail(ex.getMessage());
+            Assert.fail(ex.getMessage());
         }
     }
 
+    @Test
     public void testParseProper() {
         String source = "1 2 / 3";
 
         try {
             Fraction c = properFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(5, c.getNumerator());
-            assertEquals(3, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(5, c.getNumerator());
+            Assert.assertEquals(3, c.getDenominator());
         } catch (ParseException ex) {
-            fail(ex.getMessage());
+            Assert.fail(ex.getMessage());
         }
 
         try {
             improperFormat.parse(source);
-            fail("invalid improper fraction.");
+            Assert.fail("invalid improper fraction.");
         } catch (ParseException ex) {
             // success
         }
     }
 
+    @Test
     public void testParseProperNegative() {
         String source = "-1 2 / 3";
         try {
             Fraction c = properFormat.parse(source);
-            assertNotNull(c);
-            assertEquals(-5, c.getNumerator());
-            assertEquals(3, c.getDenominator());
+            Assert.assertNotNull(c);
+            Assert.assertEquals(-5, c.getNumerator());
+            Assert.assertEquals(3, c.getDenominator());
         } catch (ParseException ex) {
-            fail(ex.getMessage());
+            Assert.fail(ex.getMessage());
         }
 
         try {
             improperFormat.parse(source);
-            fail("invalid improper fraction.");
+            Assert.fail("invalid improper fraction.");
         } catch (ParseException ex) {
             // success
         }
     }
 
+    @Test
     public void testParseProperInvalidMinus() {
         String source = "2 -2 / 3";
         try {
             properFormat.parse(source);
-            fail("invalid minus in improper fraction.");
+            Assert.fail("invalid minus in improper fraction.");
         } catch (ParseException ex) {
             // expected
         }
         source = "2 2 / -3";
         try {
             properFormat.parse(source);
-            fail("invalid minus in improper fraction.");
+            Assert.fail("invalid minus in improper fraction.");
         } catch (ParseException ex) {
             // expected
         }
     }
 
+    @Test
     public void testNumeratorFormat() {
         NumberFormat old = properFormat.getNumeratorFormat();
         NumberFormat nf = NumberFormat.getInstance();
         nf.setParseIntegerOnly(true);
         properFormat.setNumeratorFormat(nf);
-        assertEquals(nf, properFormat.getNumeratorFormat());
+        Assert.assertEquals(nf, properFormat.getNumeratorFormat());
         properFormat.setNumeratorFormat(old);
 
         old = improperFormat.getNumeratorFormat();
         nf = NumberFormat.getInstance();
         nf.setParseIntegerOnly(true);
         improperFormat.setNumeratorFormat(nf);
-        assertEquals(nf, improperFormat.getNumeratorFormat());
+        Assert.assertEquals(nf, improperFormat.getNumeratorFormat());
         improperFormat.setNumeratorFormat(old);
     }
 
+    @Test
     public void testDenominatorFormat() {
         NumberFormat old = properFormat.getDenominatorFormat();
         NumberFormat nf = NumberFormat.getInstance();
         nf.setParseIntegerOnly(true);
         properFormat.setDenominatorFormat(nf);
-        assertEquals(nf, properFormat.getDenominatorFormat());
+        Assert.assertEquals(nf, properFormat.getDenominatorFormat());
         properFormat.setDenominatorFormat(old);
 
         old = improperFormat.getDenominatorFormat();
         nf = NumberFormat.getInstance();
         nf.setParseIntegerOnly(true);
         improperFormat.setDenominatorFormat(nf);
-        assertEquals(nf, improperFormat.getDenominatorFormat());
+        Assert.assertEquals(nf, improperFormat.getDenominatorFormat());
         improperFormat.setDenominatorFormat(old);
     }
 
+    @Test
     public void testWholeFormat() {
         ProperFractionFormat format = (ProperFractionFormat)properFormat;
 
@@ -289,15 +307,17 @@ public class FractionFormatTest extends 
         NumberFormat nf = NumberFormat.getInstance();
         nf.setParseIntegerOnly(true);
         format.setWholeFormat(nf);
-        assertEquals(nf, format.getWholeFormat());
+        Assert.assertEquals(nf, format.getWholeFormat());
         format.setWholeFormat(old);
     }
 
+    @Test
     public void testLongFormat() {
-        assertEquals("10 / 1", improperFormat.format(10l));
+        Assert.assertEquals("10 / 1", improperFormat.format(10l));
     }
 
+    @Test
     public void testDoubleFormat() {
-        assertEquals("355 / 113", improperFormat.format(FastMath.PI));
+        Assert.assertEquals("355 / 113", improperFormat.format(FastMath.PI));
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java Sun Mar 20 17:24:14 2011
@@ -21,19 +21,21 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.MathArithmeticException;
 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 FractionTest extends TestCase {
+public class FractionTest {
 
     private void assertFraction(int expectedNumerator, int expectedDenominator, Fraction actual) {
-        assertEquals(expectedNumerator, actual.getNumerator());
-        assertEquals(expectedDenominator, actual.getDenominator());
+        Assert.assertEquals(expectedNumerator, actual.getNumerator());
+        Assert.assertEquals(expectedDenominator, actual.getDenominator());
     }
 
+    @Test
     public void testConstructor() throws Exception {
         assertFraction(0, 1, new Fraction(0, 1));
         assertFraction(0, 1, new Fraction(0, 2));
@@ -48,13 +50,13 @@ public class FractionTest extends TestCa
         // overflow
         try {
             new Fraction(Integer.MIN_VALUE, -1);
-            fail();
+            Assert.fail();
         } catch (MathArithmeticException ex) {
             // success
         }
         try {
             new Fraction(1, Integer.MIN_VALUE);
-            fail();
+            Assert.fail();
         } catch (MathArithmeticException ex) {
             // success
         }
@@ -63,17 +65,19 @@ public class FractionTest extends TestCa
         assertFraction(15, 1, new Fraction(15.0000000000001));
     }
 
+    @Test
     public void testGoldenRatio() {
         try {
             // the golden ratio is notoriously a difficult number for continuous fraction
             new Fraction((1 + FastMath.sqrt(5)) / 2, 1.0e-12, 25);
-            fail("an exception should have been thrown");
+            Assert.fail("an exception should have been thrown");
         } catch (ConvergenceException ce) {
             // expected behavior
         }
     }
 
     // MATH-179
+    @Test
     public void testDoubleConstructor() throws ConvergenceException  {
         assertFraction(1, 2, new Fraction((double)1 / (double)2));
         assertFraction(1, 3, new Fraction((double)1 / (double)3));
@@ -119,6 +123,7 @@ public class FractionTest extends TestCa
     }
 
     // MATH-181
+    @Test
     public void testDigitLimitConstructor() throws ConvergenceException  {
         assertFraction(2, 5, new Fraction(0.4,   9));
         assertFraction(2, 5, new Fraction(0.4,  99));
@@ -130,6 +135,7 @@ public class FractionTest extends TestCa
         assertFraction(769, 1250, new Fraction(0.6152, 9999));
     }
 
+    @Test
     public void testIntegerOverflow() {
         checkIntegerOverflow(0.75000000001455192);
         checkIntegerOverflow(1.0e10);
@@ -138,12 +144,13 @@ public class FractionTest extends TestCa
     private void checkIntegerOverflow(double a) {
         try {
             new Fraction(a, 1.0e-12, 1000);
-            fail("an exception should have been thrown");
+            Assert.fail("an exception should have been thrown");
         } catch (ConvergenceException ce) {
             // expected behavior
         }
     }
 
+    @Test
     public void testEpsilonLimitConstructor() throws ConvergenceException  {
         assertFraction(2, 5, new Fraction(0.4, 1.0e-5, 100));
 
@@ -155,58 +162,64 @@ public class FractionTest extends TestCa
         assertFraction(769, 1250, new Fraction(0.6152, 1.0e-7, 100));
     }
 
+    @Test
     public void testCompareTo() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(1, 3);
         Fraction third = new Fraction(1, 2);
 
-        assertEquals(0, first.compareTo(first));
-        assertEquals(0, first.compareTo(third));
-        assertEquals(1, first.compareTo(second));
-        assertEquals(-1, second.compareTo(first));
+        Assert.assertEquals(0, first.compareTo(first));
+        Assert.assertEquals(0, first.compareTo(third));
+        Assert.assertEquals(1, first.compareTo(second));
+        Assert.assertEquals(-1, second.compareTo(first));
 
         // these two values are different approximations of PI
         // the first  one is approximately PI - 3.07e-18
         // the second one is approximately PI + 1.936e-17
         Fraction pi1 = new Fraction(1068966896, 340262731);
         Fraction pi2 = new Fraction( 411557987, 131002976);
-        assertEquals(-1, pi1.compareTo(pi2));
-        assertEquals( 1, pi2.compareTo(pi1));
-        assertEquals(0.0, pi1.doubleValue() - pi2.doubleValue(), 1.0e-20);
+        Assert.assertEquals(-1, pi1.compareTo(pi2));
+        Assert.assertEquals( 1, pi2.compareTo(pi1));
+        Assert.assertEquals(0.0, pi1.doubleValue() - pi2.doubleValue(), 1.0e-20);
     }
 
+    @Test
     public void testDoubleValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(1, 3);
 
-        assertEquals(0.5, first.doubleValue(), 0.0);
-        assertEquals(1.0 / 3.0, second.doubleValue(), 0.0);
+        Assert.assertEquals(0.5, first.doubleValue(), 0.0);
+        Assert.assertEquals(1.0 / 3.0, second.doubleValue(), 0.0);
     }
 
+    @Test
     public void testFloatValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(1, 3);
 
-        assertEquals(0.5f, first.floatValue(), 0.0f);
-        assertEquals((float)(1.0 / 3.0), second.floatValue(), 0.0f);
+        Assert.assertEquals(0.5f, first.floatValue(), 0.0f);
+        Assert.assertEquals((float)(1.0 / 3.0), second.floatValue(), 0.0f);
     }
 
+    @Test
     public void testIntValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(3, 2);
 
-        assertEquals(0, first.intValue());
-        assertEquals(1, second.intValue());
+        Assert.assertEquals(0, first.intValue());
+        Assert.assertEquals(1, second.intValue());
     }
 
+    @Test
     public void testLongValue() {
         Fraction first = new Fraction(1, 2);
         Fraction second = new Fraction(3, 2);
 
-        assertEquals(0L, first.longValue());
-        assertEquals(1L, second.longValue());
+        Assert.assertEquals(0L, first.longValue());
+        Assert.assertEquals(1L, second.longValue());
     }
 
+    @Test
     public void testConstructorDouble() throws Exception {
         assertFraction(1, 2, new Fraction(0.5));
         assertFraction(1, 3, new Fraction(1.0 / 3.0));
@@ -218,6 +231,7 @@ public class FractionTest extends TestCa
         assertFraction(-317, 100, new Fraction(-317.0 / 100.0));
     }
 
+    @Test
     public void testAbs() {
         Fraction a = new Fraction(10, 21);
         Fraction b = new Fraction(-10, 21);
@@ -228,63 +242,66 @@ public class FractionTest extends TestCa
         assertFraction(10, 21, c.abs());
     }
 
+    @Test
     public void testReciprocal() {
         Fraction f = null;
 
         f = new Fraction(50, 75);
         f = f.reciprocal();
-        assertEquals(3, f.getNumerator());
-        assertEquals(2, f.getDenominator());
+        Assert.assertEquals(3, f.getNumerator());
+        Assert.assertEquals(2, f.getDenominator());
 
         f = new Fraction(4, 3);
         f = f.reciprocal();
-        assertEquals(3, f.getNumerator());
-        assertEquals(4, f.getDenominator());
+        Assert.assertEquals(3, f.getNumerator());
+        Assert.assertEquals(4, f.getDenominator());
 
         f = new Fraction(-15, 47);
         f = f.reciprocal();
-        assertEquals(-47, f.getNumerator());
-        assertEquals(15, f.getDenominator());
+        Assert.assertEquals(-47, f.getNumerator());
+        Assert.assertEquals(15, f.getDenominator());
 
         f = new Fraction(0, 3);
         try {
             f = f.reciprocal();
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
 
         // large values
         f = new Fraction(Integer.MAX_VALUE, 1);
         f = f.reciprocal();
-        assertEquals(1, f.getNumerator());
-        assertEquals(Integer.MAX_VALUE, f.getDenominator());
+        Assert.assertEquals(1, f.getNumerator());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getDenominator());
     }
 
+    @Test
     public void testNegate() {
         Fraction f = null;
 
         f = new Fraction(50, 75);
         f = f.negate();
-        assertEquals(-2, f.getNumerator());
-        assertEquals(3, f.getDenominator());
+        Assert.assertEquals(-2, f.getNumerator());
+        Assert.assertEquals(3, f.getDenominator());
 
         f = new Fraction(-50, 75);
         f = f.negate();
-        assertEquals(2, f.getNumerator());
-        assertEquals(3, f.getDenominator());
+        Assert.assertEquals(2, f.getNumerator());
+        Assert.assertEquals(3, f.getDenominator());
 
         // large values
         f = new Fraction(Integer.MAX_VALUE-1, Integer.MAX_VALUE);
         f = f.negate();
-        assertEquals(Integer.MIN_VALUE+2, f.getNumerator());
-        assertEquals(Integer.MAX_VALUE, f.getDenominator());
+        Assert.assertEquals(Integer.MIN_VALUE+2, f.getNumerator());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getDenominator());
 
         f = new Fraction(Integer.MIN_VALUE, 1);
         try {
             f = f.negate();
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
     }
 
+    @Test
     public void testAdd() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
@@ -297,21 +314,21 @@ public class FractionTest extends TestCa
         Fraction f1 = new Fraction(Integer.MAX_VALUE - 1, 1);
         Fraction f2 = Fraction.ONE;
         Fraction f = f1.add(f2);
-        assertEquals(Integer.MAX_VALUE, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
         f = f1.add(1);
-        assertEquals(Integer.MAX_VALUE, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
 
         f1 = new Fraction(-1, 13*13*2*2);
         f2 = new Fraction(-2, 13*17*2);
         f = f1.add(f2);
-        assertEquals(13*13*17*2*2, f.getDenominator());
-        assertEquals(-17 - 2*13*2, f.getNumerator());
+        Assert.assertEquals(13*13*17*2*2, f.getDenominator());
+        Assert.assertEquals(-17 - 2*13*2, f.getNumerator());
 
         try {
             f.add(null);
-            fail("expecting MathIllegalArgumentException");
+            Assert.fail("expecting MathIllegalArgumentException");
         } catch (MathIllegalArgumentException ex) {}
 
         // if this fraction is added naively, it will overflow.
@@ -319,24 +336,24 @@ public class FractionTest extends TestCa
         f1 = new Fraction(1,32768*3);
         f2 = new Fraction(1,59049);
         f = f1.add(f2);
-        assertEquals(52451, f.getNumerator());
-        assertEquals(1934917632, f.getDenominator());
+        Assert.assertEquals(52451, f.getNumerator());
+        Assert.assertEquals(1934917632, f.getDenominator());
 
         f1 = new Fraction(Integer.MIN_VALUE, 3);
         f2 = new Fraction(1,3);
         f = f1.add(f2);
-        assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
-        assertEquals(3, f.getDenominator());
+        Assert.assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
+        Assert.assertEquals(3, f.getDenominator());
 
         f1 = new Fraction(Integer.MAX_VALUE - 1, 1);
         f2 = Fraction.ONE;
         f = f1.add(f2);
-        assertEquals(Integer.MAX_VALUE, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(Integer.MAX_VALUE, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
 
         try {
             f = f.add(Fraction.ONE); // should overflow
-            fail("expecting MathArithmeticException but got: " + f.toString());
+            Assert.fail("expecting MathArithmeticException but got: " + f.toString());
         } catch (MathArithmeticException ex) {}
 
         // denominator should not be a multiple of 2 or 3 to trigger overflow
@@ -344,29 +361,30 @@ public class FractionTest extends TestCa
         f2 = new Fraction(-1,5);
         try {
             f = f1.add(f2); // should overflow
-            fail("expecting MathArithmeticException but got: " + f.toString());
+            Assert.fail("expecting MathArithmeticException but got: " + f.toString());
         } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(-Integer.MAX_VALUE, 1);
             f = f.add(f);
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(-Integer.MAX_VALUE, 1);
             f = f.add(f);
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(3,327680);
         f2 = new Fraction(2,59049);
         try {
             f = f1.add(f2); // should overflow
-            fail("expecting MathArithmeticException but got: " + f.toString());
+            Assert.fail("expecting MathArithmeticException but got: " + f.toString());
         } catch (MathArithmeticException ex) {}
     }
 
+    @Test
     public void testDivide() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
@@ -380,54 +398,55 @@ public class FractionTest extends TestCa
         Fraction f2 = Fraction.ZERO;
         try {
             f1.divide(f2);
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(0, 5);
         f2 = new Fraction(2, 7);
         Fraction f = f1.divide(f2);
-        assertSame(Fraction.ZERO, f);
+        Assert.assertSame(Fraction.ZERO, f);
 
         f1 = new Fraction(2, 7);
         f2 = Fraction.ONE;
         f = f1.divide(f2);
-        assertEquals(2, f.getNumerator());
-        assertEquals(7, f.getDenominator());
+        Assert.assertEquals(2, f.getNumerator());
+        Assert.assertEquals(7, f.getDenominator());
 
         f1 = new Fraction(1, Integer.MAX_VALUE);
         f = f1.divide(f1);
-        assertEquals(1, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(1, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
 
         f1 = new Fraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         f2 = new Fraction(1, Integer.MAX_VALUE);
         f = f1.divide(f2);
-        assertEquals(Integer.MIN_VALUE, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(Integer.MIN_VALUE, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
 
         try {
             f.divide(null);
-            fail("MathIllegalArgumentException");
+            Assert.fail("MathIllegalArgumentException");
         } catch (MathIllegalArgumentException ex) {}
 
         try {
             f1 = new Fraction(1, Integer.MAX_VALUE);
             f = f1.divide(f1.reciprocal());  // should overflow
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
         try {
             f1 = new Fraction(1, -Integer.MAX_VALUE);
             f = f1.divide(f1.reciprocal());  // should overflow
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(6, 35);
         f  = f1.divide(15);
-        assertEquals(2, f.getNumerator());
-        assertEquals(175, f.getDenominator());
+        Assert.assertEquals(2, f.getNumerator());
+        Assert.assertEquals(175, f.getDenominator());
 
     }
 
+    @Test
     public void testMultiply() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
@@ -440,20 +459,21 @@ public class FractionTest extends TestCa
         Fraction f1 = new Fraction(Integer.MAX_VALUE, 1);
         Fraction f2 = new Fraction(Integer.MIN_VALUE, Integer.MAX_VALUE);
         Fraction f = f1.multiply(f2);
-        assertEquals(Integer.MIN_VALUE, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(Integer.MIN_VALUE, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
 
         try {
             f.multiply(null);
-            fail("expecting MathIllegalArgumentException");
+            Assert.fail("expecting MathIllegalArgumentException");
         } catch (MathIllegalArgumentException ex) {}
 
         f1 = new Fraction(6, 35);
         f  = f1.multiply(15);
-        assertEquals(18, f.getNumerator());
-        assertEquals(7, f.getDenominator());
+        Assert.assertEquals(18, f.getNumerator());
+        Assert.assertEquals(7, f.getDenominator());
     }
 
+    @Test
     public void testSubtract() {
         Fraction a = new Fraction(1, 2);
         Fraction b = new Fraction(2, 3);
@@ -466,7 +486,7 @@ public class FractionTest extends TestCa
         Fraction f = new Fraction(1,1);
         try {
             f.subtract(null);
-            fail("expecting MathIllegalArgumentException");
+            Assert.fail("expecting MathIllegalArgumentException");
         } catch (MathIllegalArgumentException ex) {}
 
         // if this fraction is subtracted naively, it will overflow.
@@ -474,29 +494,29 @@ public class FractionTest extends TestCa
         Fraction f1 = new Fraction(1,32768*3);
         Fraction f2 = new Fraction(1,59049);
         f = f1.subtract(f2);
-        assertEquals(-13085, f.getNumerator());
-        assertEquals(1934917632, f.getDenominator());
+        Assert.assertEquals(-13085, f.getNumerator());
+        Assert.assertEquals(1934917632, f.getDenominator());
 
         f1 = new Fraction(Integer.MIN_VALUE, 3);
         f2 = new Fraction(1,3).negate();
         f = f1.subtract(f2);
-        assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
-        assertEquals(3, f.getDenominator());
+        Assert.assertEquals(Integer.MIN_VALUE+1, f.getNumerator());
+        Assert.assertEquals(3, f.getDenominator());
 
         f1 = new Fraction(Integer.MAX_VALUE, 1);
         f2 = Fraction.ONE;
         f = f1.subtract(f2);
-        assertEquals(Integer.MAX_VALUE-1, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(Integer.MAX_VALUE-1, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
         f = f1.subtract(1);
-        assertEquals(Integer.MAX_VALUE-1, f.getNumerator());
-        assertEquals(1, f.getDenominator());
+        Assert.assertEquals(Integer.MAX_VALUE-1, f.getNumerator());
+        Assert.assertEquals(1, f.getDenominator());
 
         try {
             f1 = new Fraction(1, Integer.MAX_VALUE);
             f2 = new Fraction(1, Integer.MAX_VALUE - 1);
             f = f1.subtract(f2);
-            fail("expecting MathArithmeticException");  //should overflow
+            Assert.fail("expecting MathArithmeticException");  //should overflow
         } catch (MathArithmeticException ex) {}
 
         // denominator should not be a multiple of 2 or 3 to trigger overflow
@@ -504,64 +524,68 @@ public class FractionTest extends TestCa
         f2 = new Fraction(1,5);
         try {
             f = f1.subtract(f2); // should overflow
-            fail("expecting MathArithmeticException but got: " + f.toString());
+            Assert.fail("expecting MathArithmeticException but got: " + f.toString());
         } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(Integer.MIN_VALUE, 1);
             f = f.subtract(Fraction.ONE);
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
 
         try {
             f= new Fraction(Integer.MAX_VALUE, 1);
             f = f.subtract(Fraction.ONE.negate());
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {}
 
         f1 = new Fraction(3,327680);
         f2 = new Fraction(2,59049);
         try {
             f = f1.subtract(f2); // should overflow
-            fail("expecting MathArithmeticException but got: " + f.toString());
+            Assert.fail("expecting MathArithmeticException but got: " + f.toString());
         } catch (MathArithmeticException ex) {}
     }
 
+    @Test
     public void testEqualsAndHashCode() {
         Fraction zero  = new Fraction(0,1);
         Fraction nullFraction = null;
-        assertTrue( zero.equals(zero));
-        assertFalse(zero.equals(nullFraction));
-        assertFalse(zero.equals(Double.valueOf(0)));
+        Assert.assertTrue( zero.equals(zero));
+        Assert.assertFalse(zero.equals(nullFraction));
+        Assert.assertFalse(zero.equals(Double.valueOf(0)));
         Fraction zero2 = new Fraction(0,2);
-        assertTrue(zero.equals(zero2));
-        assertEquals(zero.hashCode(), zero2.hashCode());
+        Assert.assertTrue(zero.equals(zero2));
+        Assert.assertEquals(zero.hashCode(), zero2.hashCode());
         Fraction one = new Fraction(1,1);
-        assertFalse((one.equals(zero) ||zero.equals(one)));
+        Assert.assertFalse((one.equals(zero) ||zero.equals(one)));
     }
 
+    @Test
     public void testGetReducedFraction() {
         Fraction threeFourths = new Fraction(3, 4);
-        assertTrue(threeFourths.equals(Fraction.getReducedFraction(6, 8)));
-        assertTrue(Fraction.ZERO.equals(Fraction.getReducedFraction(0, -1)));
+        Assert.assertTrue(threeFourths.equals(Fraction.getReducedFraction(6, 8)));
+        Assert.assertTrue(Fraction.ZERO.equals(Fraction.getReducedFraction(0, -1)));
         try {
             Fraction.getReducedFraction(1, 0);
-            fail("expecting MathArithmeticException");
+            Assert.fail("expecting MathArithmeticException");
         } catch (MathArithmeticException ex) {
             // expected
         }
-        assertEquals(Fraction.getReducedFraction
+        Assert.assertEquals(Fraction.getReducedFraction
                 (2, Integer.MIN_VALUE).getNumerator(),-1);
-        assertEquals(Fraction.getReducedFraction
+        Assert.assertEquals(Fraction.getReducedFraction
                 (1, -1).getNumerator(), -1);
     }
 
+    @Test
     public void testToString() {
-        assertEquals("0", new Fraction(0, 3).toString());
-        assertEquals("3", new Fraction(6, 2).toString());
-        assertEquals("2 / 3", new Fraction(18, 27).toString());
+        Assert.assertEquals("0", new Fraction(0, 3).toString());
+        Assert.assertEquals("3", new Fraction(6, 2).toString());
+        Assert.assertEquals("2 / 3", new Fraction(18, 27).toString());
     }
 
+    @Test
     public void testSerial() throws FractionConversionException {
         Fraction[] fractions = {
             new Fraction(3, 4), Fraction.ONE, Fraction.ZERO,
@@ -569,7 +593,7 @@ public class FractionTest extends TestCa
             new Fraction(-5, 2)
         };
         for (Fraction fraction : fractions) {
-            assertEquals(fraction, TestUtils.serializeAndRecover(fraction));
+            Assert.assertEquals(fraction, TestUtils.serializeAndRecover(fraction));
         }
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryChromosomeTest.java Sun Mar 20 17:24:14 2011
@@ -16,10 +16,8 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 public class BinaryChromosomeTest {
@@ -34,7 +32,7 @@ public class BinaryChromosomeTest {
         for (Integer[] repr : reprs) {
             try {
                 new DummyBinaryChromosome(repr);
-                fail("Exception not caught");
+                Assert.fail("Exception not caught");
             } catch (IllegalArgumentException e) {
 
             }
@@ -57,11 +55,11 @@ public class BinaryChromosomeTest {
         Chromosome c5 = new DummyBinaryChromosome(new Integer[] {0,1,0,1,0,0});
         Chromosome c6 = new DummyBinaryChromosome(new Integer[] {0,1,0,1,0,1});
 
-        assertFalse(c1.isSame(c2));
-        assertFalse(c1.isSame(c3));
-        assertFalse(c1.isSame(c4));
-        assertFalse(c1.isSame(c5));
-        assertTrue(c1.isSame(c6));
+        Assert.assertFalse(c1.isSame(c2));
+        Assert.assertFalse(c1.isSame(c3));
+        Assert.assertFalse(c1.isSame(c4));
+        Assert.assertFalse(c1.isSame(c5));
+        Assert.assertTrue(c1.isSame(c6));
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/BinaryMutationTest.java Sun Mar 20 17:24:14 2011
@@ -16,8 +16,8 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 public class BinaryMutationTest {
@@ -37,7 +37,7 @@ public class BinaryMutationTest {
                 if (original.getRepresentation().get(j) != mutated.getRepresentation().get(j))
                     numDifferent++;
             }
-            assertEquals(1, numDifferent);
+            Assert.assertEquals(1, numDifferent);
         }
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ChromosomeTest.java Sun Mar 20 17:24:14 2011
@@ -16,11 +16,11 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 public class ChromosomeTest {
@@ -43,10 +43,10 @@ public class ChromosomeTest {
             }
         };
 
-        assertTrue(c1.compareTo(c2) < 0);
-        assertTrue(c2.compareTo(c1) > 0);
-        assertEquals(0,c3.compareTo(c2));
-        assertEquals(0,c2.compareTo(c3));
+        Assert.assertTrue(c1.compareTo(c2) < 0);
+        Assert.assertTrue(c2.compareTo(c1) > 0);
+        Assert.assertEquals(0,c3.compareTo(c2));
+        Assert.assertEquals(0,c2.compareTo(c3));
     }
 
     private abstract static class DummyChromosome extends Chromosome {
@@ -100,11 +100,11 @@ public class ChromosomeTest {
             }
         };
 
-        assertNull(c5.findSameChromosome(pop));
-        assertEquals(c1, c4.findSameChromosome(pop));
+        Assert.assertNull(c5.findSameChromosome(pop));
+        Assert.assertEquals(c1, c4.findSameChromosome(pop));
 
         c4.searchForFitnessUpdate(pop);
-        assertEquals(1, c4.getFitness(),0);
+        Assert.assertEquals(1, c4.getFitness(),0);
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ElitisticListPopulationTest.java Sun Mar 20 17:24:14 2011
@@ -16,8 +16,8 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 public class ElitisticListPopulationTest {
@@ -34,7 +34,7 @@ public class ElitisticListPopulationTest
 
         Population nextGeneration = pop.nextGeneration();
 
-        assertEquals(20, nextGeneration.getPopulationSize());
+        Assert.assertEquals(20, nextGeneration.getPopulationSize());
     }
 
     private static class DummyChromosome extends Chromosome {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FitnessCachingTest.java Sun Mar 20 17:24:14 2011
@@ -16,10 +16,11 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
 import java.util.LinkedList;
 import java.util.List;
+
+import org.junit.Assert;
 import org.junit.Test;
 
 
@@ -62,7 +63,7 @@ public class FitnessCachingTest {
             POPULATION_SIZE /*initial population*/ +
             (NUM_GENERATIONS - 1) /*for each population*/ * (int)(POPULATION_SIZE * (1.0 - ELITISM_RATE)) /*some chromosomes are copied*/
             ;
-        assertTrue(fitnessCalls <= neededCalls); // some chromosomes after crossover may be the same os old ones
+        Assert.assertTrue(fitnessCalls <= neededCalls); // some chromosomes after crossover may be the same os old ones
     }
 
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/FixedGenerationCountTest.java Sun Mar 20 17:24:14 2011
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
 import java.util.Iterator;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 public class FixedGenerationCountTest {
@@ -55,9 +55,10 @@ public class FixedGenerationCountTest {
             }
         };
 
-        while (!fgc.isSatisfied(pop))
+        while (!fgc.isSatisfied(pop)) {
             cnt++;
-        assertEquals(20, cnt);
+        }
+        Assert.assertEquals(20, cnt);
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestBinary.java Sun Mar 20 17:24:14 2011
@@ -16,10 +16,11 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
 import java.util.LinkedList;
 import java.util.List;
+
+import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -49,7 +50,7 @@ public class GeneticAlgorithmTestBinary 
                 new TournamentSelection(TOURNAMENT_ARITY)
         );
 
-        assertEquals(0, ga.getGenerationsEvolved());
+        Assert.assertEquals(0, ga.getGenerationsEvolved());
 
         // initial population
         Population initial = randomPopulation();
@@ -68,8 +69,8 @@ public class GeneticAlgorithmTestBinary 
         // the only thing we can test is whether the final solution is not worse than the initial one
         // however, for some implementations of GA, this need not be true :)
 
-        assertTrue(bestFinal.compareTo(bestInitial) > 0);
-        assertEquals(NUM_GENERATIONS, ga.getGenerationsEvolved());
+        Assert.assertTrue(bestFinal.compareTo(bestInitial) > 0);
+        Assert.assertEquals(NUM_GENERATIONS, ga.getGenerationsEvolved());
 
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/GeneticAlgorithmTestPermutations.java Sun Mar 20 17:24:14 2011
@@ -16,12 +16,12 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.math.util.FastMath;
+import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -79,7 +79,7 @@ public class GeneticAlgorithmTestPermuta
         // the only thing we can test is whether the final solution is not worse than the initial one
         // however, for some implementations of GA, this need not be true :)
 
-        assertTrue(bestFinal.compareTo(bestInitial) > 0);
+        Assert.assertTrue(bestFinal.compareTo(bestInitial) > 0);
 
         //System.out.println(bestInitial);
         //System.out.println(bestFinal);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/ListPopulationTest.java Sun Mar 20 17:24:14 2011
@@ -16,10 +16,10 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 public class ListPopulationTest {
@@ -55,7 +55,7 @@ public class ListPopulationTest {
             }
         };
 
-        assertEquals(c3, population.getFittestChromosome());
+        Assert.assertEquals(c3, population.getFittestChromosome());
     }
 
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/OnePointCrossoverTest.java Sun Mar 20 17:24:14 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class OnePointCrossoverTest {
@@ -42,17 +42,17 @@ public class OnePointCrossoverTest {
             c2 = ((BinaryChromosome) pair.getSecond()).getRepresentation().toArray(c2);
 
             // first and last values will be the same
-            assertEquals((int) p1[0], (int) c1[0]);
-            assertEquals((int) p2[0], (int) c2[0]);
-            assertEquals((int) p1[p1.length-1], (int) c1[c1.length-1]);
-            assertEquals((int) p2[p2.length-1], (int) c2[c2.length-1]);
+            Assert.assertEquals((int) p1[0], (int) c1[0]);
+            Assert.assertEquals((int) p2[0], (int) c2[0]);
+            Assert.assertEquals((int) p1[p1.length-1], (int) c1[c1.length-1]);
+            Assert.assertEquals((int) p2[p2.length-1], (int) c2[c2.length-1]);
             // moreover, in the above setting, the 2nd, 3rd and 7th values will be the same
-            assertEquals((int) p1[2], (int) c1[2]);
-            assertEquals((int) p2[2], (int) c2[2]);
-            assertEquals((int) p1[3], (int) c1[3]);
-            assertEquals((int) p2[3], (int) c2[3]);
-            assertEquals((int) p1[7], (int) c1[7]);
-            assertEquals((int) p2[7], (int) c2[7]);
+            Assert.assertEquals((int) p1[2], (int) c1[2]);
+            Assert.assertEquals((int) p2[2], (int) c2[2]);
+            Assert.assertEquals((int) p1[3], (int) c1[3]);
+            Assert.assertEquals((int) p2[3], (int) c2[3]);
+            Assert.assertEquals((int) p1[7], (int) c1[7]);
+            Assert.assertEquals((int) p2[7], (int) c2[7]);
         }
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java?rev=1083514&r1=1083513&r2=1083514&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/genetics/RandomKeyMutationTest.java Sun Mar 20 17:24:14 2011
@@ -16,8 +16,8 @@
  */
 package org.apache.commons.math.genetics;
 
-import static org.junit.Assert.*;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 public class RandomKeyMutationTest {
@@ -37,7 +37,7 @@ public class RandomKeyMutationTest {
                     changes++;
                 }
             }
-            assertEquals(1,changes);
+            Assert.assertEquals(1,changes);
         }
     }
 



Mime
View raw message