+ timeouts for testcases
#SPM-23: add work 30m testing
This commit is contained in:
parent
20f13467c6
commit
dd2e5b768c
@ -4,12 +4,15 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
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.assertTimeout;
|
||||
|
||||
/**
|
||||
* Test class for shopping-cart analysis.
|
||||
@ -25,12 +28,14 @@ class ShoppingCartTest {
|
||||
assert url != null;
|
||||
|
||||
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")));
|
||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Collections.singletonList("Leuchten")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Schliesstechnik", "Renovierung")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
||||
AtomicReference<Map<List<String>, List<String>>> result = new AtomicReference<>();
|
||||
assertTimeout(Duration.ofSeconds(4), () -> result.set(cart.getResult()));
|
||||
|
||||
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
|
||||
@ -39,12 +44,14 @@ class ShoppingCartTest {
|
||||
assert url != null;
|
||||
|
||||
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")));
|
||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Arrays.asList("Renovierung", "Leuchten")));
|
||||
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get(Arrays.asList("Fliesen", "Armaturen")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Renovierung")));
|
||||
AtomicReference<Map<List<String>, List<String>>> result = new AtomicReference<>();
|
||||
assertTimeout(Duration.ofSeconds(4), () -> result.set(cart.getResult()));
|
||||
|
||||
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;
|
||||
|
||||
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")));
|
||||
assertEquals(Collections.singletonList("Sanitaermaterial"), result.get(Arrays.asList("Eisenwaren", "Fliesen", "Armaturen")));
|
||||
assertEquals(Collections.singletonList("Elektromaterial"), result.get(Arrays.asList("Renovierung", "Leuchten")));
|
||||
assertEquals(Collections.singletonList("Eisenwaren"), result.get(Arrays.asList("Handwerkzeuge", "Schliesstechnik", "Baustoffe")));
|
||||
AtomicReference<Map<List<String>, List<String>>> result = new AtomicReference<>();
|
||||
assertTimeout(Duration.ofSeconds(5), () -> result.set(cart.getResult()));
|
||||
|
||||
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
Block a user