From ea7598aa645e8fdba120a66b56bb6664b435dd52 Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Fri, 3 May 2019 11:13:58 +0200 Subject: [PATCH] +Test for Cluster Analysis --- .../hsel/spm/baudas/analysis/ClusterTest.java | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/test/java/de/hsel/spm/baudas/analysis/ClusterTest.java b/src/test/java/de/hsel/spm/baudas/analysis/ClusterTest.java index 2711fa6..8eddd85 100644 --- a/src/test/java/de/hsel/spm/baudas/analysis/ClusterTest.java +++ b/src/test/java/de/hsel/spm/baudas/analysis/ClusterTest.java @@ -11,10 +11,16 @@ import java.util.concurrent.atomic.AtomicReference; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTimeout; -public class ClusterTest { +/** + * test for Cluster Analysis. + * + * @author Julian Hinxlage + * @version 0.1 + */ +class ClusterTest { @Test - public void test100() { + void test100() { URL url = getClass().getClassLoader().getResource("kd100.csv"); assert url != null; @@ -22,6 +28,35 @@ public class ClusterTest { AtomicReference>> results = new AtomicReference<>(); + + assertTimeout(Duration.ofMillis(2000), () -> results.set(cluster.getResult())); + + assertEquals("m", results.get().get(0).get("Geschlecht")); + } + + @Test + void test1000() { + URL url = getClass().getClassLoader().getResource("kd1000.csv"); + assert url != null; + + Cluster cluster = new Cluster(new File(url.getFile())); + + AtomicReference>> results = new AtomicReference<>(); + + assertTimeout(Duration.ofMillis(2000), () -> results.set(cluster.getResult())); + + assertEquals("m", results.get().get(0).get("Geschlecht")); + } + + @Test + void test10000() { + URL url = getClass().getClassLoader().getResource("kd10000.csv"); + assert url != null; + + Cluster cluster = new Cluster(new File(url.getFile())); + + AtomicReference>> results = new AtomicReference<>(); + assertTimeout(Duration.ofMillis(2000), () -> results.set(cluster.getResult())); assertEquals("m", results.get().get(0).get("Geschlecht"));