commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1066299 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java
Date Wed, 02 Feb 2011 01:37:49 GMT
Author: sebb
Date: Wed Feb  2 01:37:49 2011
New Revision: 1066299

URL: http://svn.apache.org/viewvc?rev=1066299&view=rev
Log:
No point catching and then calling fail - just let JUnit do the work

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java?rev=1066299&r1=1066298&r2=1066299&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java
Wed Feb  2 01:37:49 2011
@@ -167,12 +167,8 @@ public abstract class RealVectorFormatAb
     public void testParseSimpleNoDecimals() {
         String source = "{1; 1; 1}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {1, 1, 1});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -196,12 +192,8 @@ public abstract class RealVectorFormatAb
             "43; 1" + getDecimalCharacter() +
             "63}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {1.23, 1.43, 1.63});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -212,12 +204,8 @@ public abstract class RealVectorFormatAb
             "4343; 1" + getDecimalCharacter() +
             "6333}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {1.2323, 1.4343, 1.6333});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -228,12 +216,8 @@ public abstract class RealVectorFormatAb
             "4343; 1" + getDecimalCharacter() +
             "6333}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {-1.2323, 1.4343, 1.6333});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -244,12 +228,8 @@ public abstract class RealVectorFormatAb
             "4343; 1" + getDecimalCharacter() +
             "6333}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {1.2323, -1.4343, 1.6333});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -260,12 +240,8 @@ public abstract class RealVectorFormatAb
             "4343; -1" + getDecimalCharacter() +
             "6333}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {1.2323, 1.4343, -1.6333});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -276,12 +252,8 @@ public abstract class RealVectorFormatAb
             "4343; -1" + getDecimalCharacter() +
             "6333}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {-1.2323, -1.4343, -1.6333});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -292,12 +264,8 @@ public abstract class RealVectorFormatAb
             "4343; 1" + getDecimalCharacter() +
             "6333}";
         ArrayRealVector expected = new ArrayRealVector(new double[] {0.0, -1.4343, 1.6333});
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
@@ -308,49 +276,33 @@ public abstract class RealVectorFormatAb
             "4343 : 1" + getDecimalCharacter() +
             "6333]";
         ArrayRealVector expected = new ArrayRealVector(new double[] {1.2323, 1.4343, 1.6333});
-        try {
-            ArrayRealVector actual = realVectorFormatSquare.parse(source);
-            Assert.assertEquals(expected, actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormatSquare.parse(source);
+        Assert.assertEquals(expected, actual);
     }
 
     @Test
     public void testParseNan() {
         String source = "{(NaN); (NaN); (NaN)}";
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(new ArrayRealVector(new double[] {Double.NaN, Double.NaN,
Double.NaN}), actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(new ArrayRealVector(new double[] {Double.NaN, Double.NaN, Double.NaN}),
actual);
     }
 
     @Test
     public void testParsePositiveInfinity() {
         String source = "{(Infinity); (Infinity); (Infinity)}";
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(new ArrayRealVector(new double[] {
-                    Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY
-            }), actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(new ArrayRealVector(new double[] {
+                Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY
+        }), actual);
     }
 
     @Test
     public void testParseNegativeInfinity() {
         String source = "{(-Infinity); (-Infinity); (-Infinity)}";
-        try {
-            ArrayRealVector actual = realVectorFormat.parse(source);
-            Assert.assertEquals(new ArrayRealVector(new double[] {
-                    Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY
-            }), actual);
-        } catch (MathParseException ex) {
-            Assert.fail(ex.getMessage());
-        }
+        ArrayRealVector actual = realVectorFormat.parse(source);
+        Assert.assertEquals(new ArrayRealVector(new double[] {
+                Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY
+        }), actual);
     }
 
     @Test



Mime
View raw message