@Test public void testExisDay_blocks() { LocalDate testDay = LocalDate.of(2015, 9, 10); Cook p1 = createPerson("a", newHashSet(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY), newHashSet()); Cook p2 = createPerson("b", newHashSet(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY), newHashSet()); p2.setExit(testDay.minusDays(1)); CookingDay c1 = new CookingDay(p1, LocalDate.of(2015, 6, 30)); kl = new CookingListImpl(Arrays.asList(p1, p2), Arrays.asList(c1)); CookingDay day = kl.determineCookFor(testDay); assertThat(day.getCook(), is(p1)); }
private Cook createPerson(String id, HashSet<DayOfWeek> preferred, HashSet<DayOfWeek> noGo) { Cook person = new Cook(id); person.setNoGo(noGo); person.setPreferred(preferred); return person; }