@Test public void getInstanceAfterWorkingMillis () { final Instant startTime = Instant.ofEpochSecond(1565971200); assertEquals(Instant.ofEpochSecond(1566204300), holidayManager.getInstantAfterWorkingMillis(startTime, 2700000L)); assertEquals(Instant.ofEpochSecond(1566313200), holidayManager.getInstantAfterWorkingMillis(startTime, 54000000L)); }
public Instant getInstantAfterWorkingMillis (Instant start, long workingMillis) { Calendar calendar = GregorianCalendar.from(ZonedDateTime.ofInstant(start, holidayCalendar.getTimeZoneId())); long millisLeftInDay; boolean looper = true; do { millisLeftInDay = getMillisLeftInDay(calendar); if (millisLeftInDay < workingMillis) { incrementCalendarToMidnight(calendar); workingMillis -= millisLeftInDay; } else { looper = false; } } while (looper); return calendar.toInstant().plusMillis(workingMillis); }
HolidayManager { public Instant getInstantAfterWorkingMillis (Instant start, long workingMillis) { Calendar calendar = GregorianCalendar.from(ZonedDateTime.ofInstant(start, holidayCalendar.getTimeZoneId())); long millisLeftInDay; boolean looper = true; do { millisLeftInDay = getMillisLeftInDay(calendar); if (millisLeftInDay < workingMillis) { incrementCalendarToMidnight(calendar); workingMillis -= millisLeftInDay; } else { looper = false; } } while (looper); return calendar.toInstant().plusMillis(workingMillis); } }
HolidayManager { public Instant getInstantAfterWorkingMillis (Instant start, long workingMillis) { Calendar calendar = GregorianCalendar.from(ZonedDateTime.ofInstant(start, holidayCalendar.getTimeZoneId())); long millisLeftInDay; boolean looper = true; do { millisLeftInDay = getMillisLeftInDay(calendar); if (millisLeftInDay < workingMillis) { incrementCalendarToMidnight(calendar); workingMillis -= millisLeftInDay; } else { looper = false; } } while (looper); return calendar.toInstant().plusMillis(workingMillis); }  }
HolidayManager { public Instant getInstantAfterWorkingMillis (Instant start, long workingMillis) { Calendar calendar = GregorianCalendar.from(ZonedDateTime.ofInstant(start, holidayCalendar.getTimeZoneId())); long millisLeftInDay; boolean looper = true; do { millisLeftInDay = getMillisLeftInDay(calendar); if (millisLeftInDay < workingMillis) { incrementCalendarToMidnight(calendar); workingMillis -= millisLeftInDay; } else { looper = false; } } while (looper); return calendar.toInstant().plusMillis(workingMillis); }  Instant getPreviousWorkingDay(); boolean isHoliday(); long getMillisLeftInDay(); Instant getInstantAfterWorkingMillis(Instant start, long workingMillis); boolean isOutsideWorkingHours(); }
HolidayManager { public Instant getInstantAfterWorkingMillis (Instant start, long workingMillis) { Calendar calendar = GregorianCalendar.from(ZonedDateTime.ofInstant(start, holidayCalendar.getTimeZoneId())); long millisLeftInDay; boolean looper = true; do { millisLeftInDay = getMillisLeftInDay(calendar); if (millisLeftInDay < workingMillis) { incrementCalendarToMidnight(calendar); workingMillis -= millisLeftInDay; } else { looper = false; } } while (looper); return calendar.toInstant().plusMillis(workingMillis); }  Instant getPreviousWorkingDay(); boolean isHoliday(); long getMillisLeftInDay(); Instant getInstantAfterWorkingMillis(Instant start, long workingMillis); boolean isOutsideWorkingHours();  }