@Test public void isHoliday () { final Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); doReturn(Collections.emptySet()).when(chaosCalendar).computeHolidays(year); verify(chaosCalendar, never()).computeHolidays(year); assertFalse(chaosCalendar.isHoliday(calendar)); verify(chaosCalendar, times(1)).computeHolidays(year); assertFalse(chaosCalendar.isHoliday(calendar)); verify(chaosCalendar, times(1)).computeHolidays(year); }
@Override public boolean isHoliday (Calendar day) { int year = day.get(YEAR); return holidayMap.computeIfAbsent(year, this::computeHolidays).contains(day.get(DAY_OF_YEAR)); }
ChaosCalendar implements HolidayCalendar { @Override public boolean isHoliday (Calendar day) { int year = day.get(YEAR); return holidayMap.computeIfAbsent(year, this::computeHolidays).contains(day.get(DAY_OF_YEAR)); } }
ChaosCalendar implements HolidayCalendar { @Override public boolean isHoliday (Calendar day) { int year = day.get(YEAR); return holidayMap.computeIfAbsent(year, this::computeHolidays).contains(day.get(DAY_OF_YEAR)); } ChaosCalendar(String timezoneName, int startOfDay, int endOfDay); }
ChaosCalendar implements HolidayCalendar { @Override public boolean isHoliday (Calendar day) { int year = day.get(YEAR); return holidayMap.computeIfAbsent(year, this::computeHolidays).contains(day.get(DAY_OF_YEAR)); } 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 { @Override public boolean isHoliday (Calendar day) { int year = day.get(YEAR); return holidayMap.computeIfAbsent(year, this::computeHolidays).contains(day.get(DAY_OF_YEAR)); } ChaosCalendar(String timezoneName, int startOfDay, int endOfDay); @Override boolean isHoliday(Calendar day); @Override ZoneId getTimeZoneId(); @Override int getStartOfDay(); @Override int getEndOfDay(); @Override TimeZone getTimeZone();  }