parent
20f13467c6
commit
dd2e5b768c
|
@ -4,12 +4,15 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for shopping-cart analysis.
|
* Test class for shopping-cart analysis.
|
||||||
|
@ -25,12 +28,14 @@ class ShoppingCartTest {
|
||||||
assert url != null;
|
assert url != null;
|
||||||
|
|
||||||
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
||||||
Map<List<String>, List<String>> result = cart.getResult();
|
|
||||||
|
|
||||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik")));
|
AtomicReference<Map<List<String>, List<String>>> result = new AtomicReference<>();
|
||||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Collections.singletonList("Leuchten")));
|
assertTimeout(Duration.ofSeconds(4), () -> result.set(cart.getResult()));
|
||||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Schliesstechnik", "Renovierung")));
|
|
||||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
assertEquals(Collections.singletonList("Eisenwaren"), result.get().get(Arrays.asList("Handwerkzeuge", "Schliesstechnik")));
|
||||||
|
assertEquals(Collections.singletonList("Elektromaterial"), result.get().get(Collections.singletonList("Leuchten")));
|
||||||
|
assertEquals(Collections.singletonList("Eisenwaren"), result.get().get(Arrays.asList("Schliesstechnik", "Renovierung")));
|
||||||
|
assertEquals(Collections.singletonList("Eisenwaren"), result.get().get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -39,12 +44,14 @@ class ShoppingCartTest {
|
||||||
assert url != null;
|
assert url != null;
|
||||||
|
|
||||||
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
||||||
Map<List<String>, List<String>> result = cart.getResult();
|
|
||||||
|
|
||||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Elektromaterial")));
|
AtomicReference<Map<List<String>, List<String>>> result = new AtomicReference<>();
|
||||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Arrays.asList("Renovierung", "Leuchten")));
|
assertTimeout(Duration.ofSeconds(4), () -> result.set(cart.getResult()));
|
||||||
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get(Arrays.asList("Fliesen", "Armaturen")));
|
|
||||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Renovierung")));
|
assertEquals(Collections.singletonList("Eisenwaren"), result.get().get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Elektromaterial")));
|
||||||
|
assertEquals(Collections.singletonList("Elektromaterial"), result.get().get(Arrays.asList("Renovierung", "Leuchten")));
|
||||||
|
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get().get(Arrays.asList("Fliesen", "Armaturen")));
|
||||||
|
assertEquals(Collections.singletonList("Eisenwaren"), result.get().get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Renovierung")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +61,14 @@ class ShoppingCartTest {
|
||||||
assert url != null;
|
assert url != null;
|
||||||
|
|
||||||
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
ShoppingCart cart = new ShoppingCart(new File(url.getFile()));
|
||||||
Map<List<String>, List<String>> result = cart.getResult();
|
|
||||||
|
|
||||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Elektromaterial")));
|
AtomicReference<Map<List<String>, List<String>>> result = new AtomicReference<>();
|
||||||
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get(Arrays.asList("Eisenwaren", "Fliesen", "Armaturen")));
|
assertTimeout(Duration.ofSeconds(5), () -> result.set(cart.getResult()));
|
||||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Arrays.asList("Renovierung", "Leuchten")));
|
|
||||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
assertEquals(Collections.singletonList("Eisenwaren"), result.get().get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Elektromaterial")));
|
||||||
|
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get().get(Arrays.asList("Eisenwaren", "Fliesen", "Armaturen")));
|
||||||
|
assertEquals(Collections.singletonList("Elektromaterial"), result.get().get(Arrays.asList("Renovierung", "Leuchten")));
|
||||||
|
assertEquals(Collections.singletonList("Eisenwaren"), result.get().get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue