+Test for Cluster Analysis

This commit is contained in:
Julian Hinxlage 2019-05-03 11:13:58 +02:00
parent 0f05fd04b1
commit ea7598aa64
1 changed files with 37 additions and 2 deletions

View File

@ -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.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTimeout; import static org.junit.jupiter.api.Assertions.assertTimeout;
public class ClusterTest { /**
* test for Cluster Analysis.
*
* @author Julian Hinxlage
* @version 0.1
*/
class ClusterTest {
@Test @Test
public void test100() { void test100() {
URL url = getClass().getClassLoader().getResource("kd100.csv"); URL url = getClass().getClassLoader().getResource("kd100.csv");
assert url != null; assert url != null;
@ -22,6 +28,35 @@ public class ClusterTest {
AtomicReference<Map<Integer, Map<String, String>>> results = new AtomicReference<>(); AtomicReference<Map<Integer, Map<String, String>>> 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<Map<Integer, Map<String, String>>> 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<Map<Integer, Map<String, String>>> results = new AtomicReference<>();
assertTimeout(Duration.ofMillis(2000), () -> results.set(cluster.getResult())); assertTimeout(Duration.ofMillis(2000), () -> results.set(cluster.getResult()));
assertEquals("m", results.get().get(0).get("Geschlecht")); assertEquals("m", results.get().get(0).get("Geschlecht"));