Test Cases

This commit is contained in:
Karsten 2019-05-02 14:31:42 +02:00
parent feec46ecad
commit 5541e1b9c8
1 changed files with 28 additions and 4 deletions

View File

@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTimeout; import static org.junit.jupiter.api.Assertions.assertTimeout;
/** /**
* @author hier Namen eintragen * @author Karsten Eden
* @version 0.1 * @version 0.1
* @since 0.1 * @since 0.1
**/ **/
@ -31,7 +31,27 @@ public class ShoppingTimesTest {
assertTimeout(Duration.ofMillis(1700), () -> results.set(overview.getResult())); assertTimeout(Duration.ofMillis(1700), () -> results.set(overview.getResult()));
assertEquals(4, results.get().get(new DayHour("Montag", "10-12 Uhr"))); assertEquals(4, results.get().get(new DayHour("Montag", "10-12 Uhr")));
//TODO: mehr Tests assertEquals(9, results.get().get(new DayHour("Samstag", "12-14 Uhr")));
assertEquals(1, results.get().get(new DayHour("Donnerstag", "14-17 Uhr")));
assertEquals(3, results.get().get(new DayHour("Mittwoch", ">17 Uhr")));
assertEquals(6, results.get().get(new DayHour("Dienstag", "<10 Uhr")));
}
@Test
public void test1000(){
URL url = getClass().getClassLoader().getResource("kd1000.csv");
assert url != null;
ShoppingTimes overview = new ShoppingTimes(new File(url.getFile()));
AtomicReference<Map<DayHour, Integer>> results = new AtomicReference<>();
assertTimeout(Duration.ofMillis(3000), () -> results.set(overview.getResult()));
assertEquals(37, results.get().get(new DayHour("Montag", "10-12 Uhr")));
assertEquals(87, results.get().get(new DayHour("Samstag", "12-14 Uhr")));
assertEquals(23, results.get().get(new DayHour("Donnerstag", "14-17 Uhr")));
assertEquals(18, results.get().get(new DayHour("Mittwoch", ">17 Uhr")));
assertEquals(18, results.get().get(new DayHour("Dienstag", "<10 Uhr")));
} }
@Test @Test
@ -42,8 +62,12 @@ public class ShoppingTimesTest {
AtomicReference<Map<DayHour, Integer>> results = new AtomicReference<>(); AtomicReference<Map<DayHour, Integer>> results = new AtomicReference<>();
assertTimeout(Duration.ofMillis(550), () -> results.set(overview.getResult())); assertTimeout(Duration.ofMillis(3000), () -> results.set(overview.getResult()));
//TODO: mehr Tests assertEquals(303, results.get().get(new DayHour("Montag", "10-12 Uhr")));
assertEquals(737, results.get().get(new DayHour("Samstag", "12-14 Uhr")));
assertEquals(192, results.get().get(new DayHour("Donnerstag", "14-17 Uhr")));
assertEquals(199, results.get().get(new DayHour("Mittwoch", ">17 Uhr")));
assertEquals(149, results.get().get(new DayHour("Dienstag", "<10 Uhr")));
} }
} }