@Test public void computeHolidays () { doReturn(Set.of(1, 5, 7)).when(chaosCalendar).getStaticHolidays(YEAR); doReturn(Set.of(50, 80, 90)).when(chaosCalendar).getMovingHolidays(YEAR); doReturn(Set.of(2, 51, 91)).when(chaosCalendar).getLinkedDays(Set.of(1, 5, 7, 50, 80, 90), YEAR); assertThat(chaosCalendar.computeHolidays(YEAR), containsInAnyOrder(1, 2, 5, 7, 50, 51, 80, 90, 91)); }
protected Collection<Integer> computeHolidays (int year) { Set<Integer> holidays = new TreeSet<>(); holidays.addAll(getStaticHolidays(year)); holidays.addAll(getMovingHolidays(year)); holidays.addAll(getLinkedDays(holidays, year)); return holidays; }
ChaosCalendar implements HolidayCalendar { protected Collection<Integer> computeHolidays (int year) { Set<Integer> holidays = new TreeSet<>(); holidays.addAll(getStaticHolidays(year)); holidays.addAll(getMovingHolidays(year)); holidays.addAll(getLinkedDays(holidays, year)); return holidays; } }
ChaosCalendar implements HolidayCalendar { protected Collection<Integer> computeHolidays (int year) { Set<Integer> holidays = new TreeSet<>(); holidays.addAll(getStaticHolidays(year)); holidays.addAll(getMovingHolidays(year)); holidays.addAll(getLinkedDays(holidays, year)); return holidays; } ChaosCalendar(String timezoneName, int startOfDay, int endOfDay); }
ChaosCalendar implements HolidayCalendar { protected Collection<Integer> computeHolidays (int year) { Set<Integer> holidays = new TreeSet<>(); holidays.addAll(getStaticHolidays(year)); holidays.addAll(getMovingHolidays(year)); holidays.addAll(getLinkedDays(holidays, year)); return holidays; } ChaosCalendar(String timezoneName, int startOfDay, int endOfDay); @Override boolean isHoliday(Calendar day); @Override ZoneId getTimeZoneId(); @Override int getStartOfDay(); @Override int getEndOfDay(); @Override TimeZone getTimeZone(); }
ChaosCalendar implements HolidayCalendar { protected Collection<Integer> computeHolidays (int year) { Set<Integer> holidays = new TreeSet<>(); holidays.addAll(getStaticHolidays(year)); holidays.addAll(getMovingHolidays(year)); holidays.addAll(getLinkedDays(holidays, year)); return holidays; } ChaosCalendar(String timezoneName, int startOfDay, int endOfDay); @Override boolean isHoliday(Calendar day); @Override ZoneId getTimeZoneId(); @Override int getStartOfDay(); @Override int getEndOfDay(); @Override TimeZone getTimeZone();  }