You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2013/06/01 19:09:30 UTC
svn commit: r1488545 -
/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ml/clustering/FuzzyKMeansClustererTest.java
Author: psteitz
Date: Sat Jun 1 17:09:30 2013
New Revision: 1488545
URL: http://svn.apache.org/r1488545
Log:
Replace wildcard imports, add final declarations.
Modified:
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ml/clustering/FuzzyKMeansClustererTest.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=1488545&r1=1488544&r2=1488545&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 Sat Jun 1 17:09:30 2013
@@ -16,8 +16,10 @@
*/
package org.apache.commons.math3.ml.clustering;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+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 java.util.ArrayList;
import java.util.Arrays;
@@ -35,11 +37,11 @@ public class FuzzyKMeansClustererTest {
@Test
public void testCluster() {
- List<DoublePoint> points = new ArrayList<DoublePoint>();
-
+ final List<DoublePoint> points = new ArrayList<DoublePoint>();
+
// create 10 data points: [1], ... [10]
for (int i = 1; i <= 10; i++) {
- DoublePoint p = new DoublePoint(new double[] { i } );
+ final DoublePoint p = new DoublePoint(new double[] { i } );
points.add(p);
}
@@ -82,17 +84,17 @@ public class FuzzyKMeansClustererTest {
@Test(expected = NullArgumentException.class)
public void testNullDataset() {
- FuzzyKMeansClusterer<DoublePoint> clusterer = new FuzzyKMeansClusterer<DoublePoint>(3, 2.0);
+ final FuzzyKMeansClusterer<DoublePoint> clusterer = new FuzzyKMeansClusterer<DoublePoint>(3, 2.0);
clusterer.cluster(null);
}
-
+
@Test
public void testGetters() {
- DistanceMeasure measure = new CanberraDistance();
- RandomGenerator random = new JDKRandomGenerator();
- FuzzyKMeansClusterer<DoublePoint> clusterer =
+ final DistanceMeasure measure = new CanberraDistance();
+ final RandomGenerator random = new JDKRandomGenerator();
+ 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());