You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2013/06/02 19:02:35 UTC
svn commit: r1488743 - in
/commons/proper/math/trunk/src/test/java/org/apache/commons/math3:
ml/clustering/ ode/events/ ode/sampling/ random/ util/
Author: luc
Date: Sun Jun 2 17:02:34 2013
New Revision: 1488743
URL: http://svn.apache.org/r1488743
Log:
Removed import static.
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ml/clustering/FuzzyKMeansClustererTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/events/ReappearingEventTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/MathArraysTest.java
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ml/clustering/FuzzyKMeansClustererTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ml/clustering/FuzzyKMeansClustererTest.java?rev=1488743&r1=1488742&r2=1488743&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ml/clustering/FuzzyKMeansClustererTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ml/clustering/FuzzyKMeansClustererTest.java Sun Jun 2 17:02:34 2013
@@ -16,10 +16,8 @@
*/
package org.apache.commons.math3.ml.clustering;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import org.hamcrest.CoreMatchers;
+import org.junit.Assert;
import java.util.ArrayList;
import java.util.Arrays;
@@ -60,7 +58,7 @@ public class FuzzyKMeansClustererTest {
boolean cluster1Found = false;
boolean cluster2Found = false;
boolean cluster3Found = false;
- assertEquals(3, clusters.size());
+ Assert.assertEquals(3, clusters.size());
for (final Cluster<DoublePoint> cluster : clusters) {
if (cluster.getPoints().containsAll(clusterOne)) {
cluster1Found = true;
@@ -72,9 +70,9 @@ public class FuzzyKMeansClustererTest {
cluster3Found = true;
}
}
- assertTrue(cluster1Found);
- assertTrue(cluster2Found);
- assertTrue(cluster3Found);
+ Assert.assertTrue(cluster1Found);
+ Assert.assertTrue(cluster2Found);
+ Assert.assertTrue(cluster3Found);
}
@Test(expected = MathIllegalArgumentException.class)
@@ -95,12 +93,12 @@ public class FuzzyKMeansClustererTest {
final FuzzyKMeansClusterer<DoublePoint> clusterer =
new FuzzyKMeansClusterer<DoublePoint>(3, 2.0, 100, measure, 1e-6, random);
- assertEquals(3, clusterer.getK());
- assertEquals(2.0, clusterer.getFuzziness(), 1e-6);
- assertEquals(100, clusterer.getMaxIterations());
- assertEquals(1e-6, clusterer.getEpsilon(), 1e-12);
- assertThat(clusterer.getDistanceMeasure(), is(measure));
- assertThat(clusterer.getRandomGenerator(), is(random));
+ Assert.assertEquals(3, clusterer.getK());
+ Assert.assertEquals(2.0, clusterer.getFuzziness(), 1e-6);
+ Assert.assertEquals(100, clusterer.getMaxIterations());
+ Assert.assertEquals(1e-6, clusterer.getEpsilon(), 1e-12);
+ Assert.assertThat(clusterer.getDistanceMeasure(), CoreMatchers.is(measure));
+ Assert.assertThat(clusterer.getRandomGenerator(), CoreMatchers.is(random));
}
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/events/ReappearingEventTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/events/ReappearingEventTest.java?rev=1488743&r1=1488742&r2=1488743&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/events/ReappearingEventTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/events/ReappearingEventTest.java Sun Jun 2 17:02:34 2013
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math3.ode.events;
-import static org.junit.Assert.assertEquals;
+import org.junit.Assert;
import java.util.Arrays;
@@ -38,7 +38,7 @@ public class ReappearingEventTest {
throws DimensionMismatchException, NumberIsTooSmallException,
MaxCountExceededException, NoBracketingException {
double tEnd = test(1);
- assertEquals(10.0, tEnd, 1e-7);
+ Assert.assertEquals(10.0, tEnd, 1e-7);
}
@Test
@@ -46,7 +46,7 @@ public class ReappearingEventTest {
throws DimensionMismatchException, NumberIsTooSmallException,
MaxCountExceededException, NoBracketingException {
double tEnd = test(2);
- assertEquals(10.0, tEnd, 1e-7);
+ Assert.assertEquals(10.0, tEnd, 1e-7);
}
public double test(int integratorType)
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java?rev=1488743&r1=1488742&r2=1488743&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java Sun Jun 2 17:02:34 2013
@@ -17,7 +17,7 @@
package org.apache.commons.math3.ode.sampling;
-import static org.junit.Assert.assertArrayEquals;
+import org.junit.Assert;
import java.util.ArrayList;
import java.util.List;
@@ -257,7 +257,7 @@ public abstract class StepNormalizerOutp
for(int i = 0; i < actual.length; i++) {
actual[i] = output.get(i);
}
- assertArrayEquals(expected, actual, 1e-5);
+ Assert.assertArrayEquals(expected, actual, 1e-5);
}
/** {@inheritDoc} */
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java?rev=1488743&r1=1488742&r2=1488743&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/HaltonSequenceGeneratorTest.java Sun Jun 2 17:02:34 2013
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math3.random;
-import static org.junit.Assert.*;
+import org.junit.Assert;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NullArgumentException;
@@ -63,8 +63,8 @@ public class HaltonSequenceGeneratorTest
public void test3DReference() {
for (int i = 0; i < referenceValues.length; i++) {
double[] result = generator.nextVector();
- assertArrayEquals(referenceValues[i], result, 1e-3);
- assertEquals(i + 1, generator.getNextIndex());
+ Assert.assertArrayEquals(referenceValues[i], result, 1e-3);
+ Assert.assertEquals(i + 1, generator.getNextIndex());
}
}
@@ -73,8 +73,8 @@ public class HaltonSequenceGeneratorTest
generator = new HaltonSequenceGenerator(2, new int[] {2, 3}, null);
for (int i = 0; i < referenceValuesUnscrambled.length; i++) {
double[] result = generator.nextVector();
- assertArrayEquals(referenceValuesUnscrambled[i], result, 1e-3);
- assertEquals(i + 1, generator.getNextIndex());
+ Assert.assertArrayEquals(referenceValuesUnscrambled[i], result, 1e-3);
+ Assert.assertEquals(i + 1, generator.getNextIndex());
}
}
@@ -82,14 +82,14 @@ public class HaltonSequenceGeneratorTest
public void testConstructor() {
try {
new HaltonSequenceGenerator(0);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (OutOfRangeException e) {
// expected
}
try {
new HaltonSequenceGenerator(41);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (OutOfRangeException e) {
// expected
}
@@ -99,21 +99,21 @@ public class HaltonSequenceGeneratorTest
public void testConstructor2() throws Exception{
try {
new HaltonSequenceGenerator(2, new int[] { 1 }, null);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (OutOfRangeException e) {
// expected
}
try {
new HaltonSequenceGenerator(2, null, null);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (NullArgumentException e) {
// expected
}
try {
new HaltonSequenceGenerator(2, new int[] { 1, 1 }, new int[] { 1 });
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (DimensionMismatchException e) {
// expected
}
@@ -122,13 +122,13 @@ public class HaltonSequenceGeneratorTest
@Test
public void testSkip() {
double[] result = generator.skipTo(5);
- assertArrayEquals(referenceValues[5], result, 1e-3);
- assertEquals(6, generator.getNextIndex());
+ Assert.assertArrayEquals(referenceValues[5], result, 1e-3);
+ Assert.assertEquals(6, generator.getNextIndex());
for (int i = 6; i < referenceValues.length; i++) {
result = generator.nextVector();
- assertArrayEquals(referenceValues[i], result, 1e-3);
- assertEquals(i + 1, generator.getNextIndex());
+ Assert.assertArrayEquals(referenceValues[i], result, 1e-3);
+ Assert.assertEquals(i + 1, generator.getNextIndex());
}
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java?rev=1488743&r1=1488742&r2=1488743&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/SobolSequenceGeneratorTest.java Sun Jun 2 17:02:34 2013
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math3.random;
-import static org.junit.Assert.*;
+import org.junit.Assert;
import java.io.InputStream;
@@ -50,8 +50,8 @@ public class SobolSequenceGeneratorTest
public void test3DReference() {
for (int i = 0; i < referenceValues.length; i++) {
double[] result = generator.nextVector();
- assertArrayEquals(referenceValues[i], result, 1e-6);
- assertEquals(i + 1, generator.getNextIndex());
+ Assert.assertArrayEquals(referenceValues[i], result, 1e-6);
+ Assert.assertEquals(i + 1, generator.getNextIndex());
}
}
@@ -59,14 +59,14 @@ public class SobolSequenceGeneratorTest
public void testConstructor() {
try {
new SobolSequenceGenerator(0);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (OutOfRangeException e) {
// expected
}
try {
new SobolSequenceGenerator(1001);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (OutOfRangeException e) {
// expected
}
@@ -78,14 +78,14 @@ public class SobolSequenceGeneratorTest
final String RESOURCE_NAME = "/assets/org/apache/commons/math3/random/new-joe-kuo-6.1000";
final InputStream is = getClass().getResourceAsStream(RESOURCE_NAME);
new SobolSequenceGenerator(1001, is);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (OutOfRangeException e) {
// expected
}
try {
new SobolSequenceGenerator(1001);
- fail();
+ Assert.fail("an exception should have been thrown");
} catch (OutOfRangeException e) {
// expected
}
@@ -94,13 +94,13 @@ public class SobolSequenceGeneratorTest
@Test
public void testSkip() {
double[] result = generator.skipTo(5);
- assertArrayEquals(referenceValues[5], result, 1e-6);
- assertEquals(6, generator.getNextIndex());
+ Assert.assertArrayEquals(referenceValues[5], result, 1e-6);
+ Assert.assertEquals(6, generator.getNextIndex());
for (int i = 6; i < referenceValues.length; i++) {
result = generator.nextVector();
- assertArrayEquals(referenceValues[i], result, 1e-6);
- assertEquals(i + 1, generator.getNextIndex());
+ Assert.assertArrayEquals(referenceValues[i], result, 1e-6);
+ Assert.assertEquals(i + 1, generator.getNextIndex());
}
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/MathArraysTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/MathArraysTest.java?rev=1488743&r1=1488742&r2=1488743&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/MathArraysTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/MathArraysTest.java Sun Jun 2 17:02:34 2013
@@ -13,8 +13,6 @@
*/
package org.apache.commons.math3.util;
-import static org.junit.Assert.fail;
-
import java.util.Arrays;
import org.apache.commons.math3.TestUtils;
@@ -861,35 +859,35 @@ public class MathArraysTest {
try {
MathArrays.convolve(new double[]{1, 2}, null);
- fail("an exception should have been thrown");
+ Assert.fail("an exception should have been thrown");
} catch (NullArgumentException e) {
// expected behavior
}
try {
MathArrays.convolve(null, new double[]{1, 2});
- fail("an exception should have been thrown");
+ Assert.fail("an exception should have been thrown");
} catch (NullArgumentException e) {
// expected behavior
}
try {
MathArrays.convolve(new double[]{1, 2}, new double[]{});
- fail("an exception should have been thrown");
+ Assert.fail("an exception should have been thrown");
} catch (NoDataException e) {
// expected behavior
}
try {
MathArrays.convolve(new double[]{}, new double[]{1, 2});
- fail("an exception should have been thrown");
+ Assert.fail("an exception should have been thrown");
} catch (NoDataException e) {
// expected behavior
}
try {
MathArrays.convolve(new double[]{}, new double[]{});
- fail("an exception should have been thrown");
+ Assert.fail("an exception should have been thrown");
} catch (NoDataException e) {
// expected behavior
}