BusinessDateTime implements Temporal, ChronoZonedDateTime<LocalDate>, Serializable { public ZonedDateTime toZonedDateTime() { return move(0, Constants.NANOS_PER_NANO).dateTime; } BusinessDateTime(ZonedDateTime dateTime,
                          LocalTime dayStartTime,
                          LocalTime dayEndTime,
                          Set<LocalDate> holidays,
                          WorkingWeek workingWeek);  BusinessDateTime(ZonedDateTime dateTime,
                          LocalTime dayStartTime,
                          LocalTime dayEndTime,
                          Set<LocalDate> holidays);  BusinessDateTime(LocalTime dayStartTime, LocalTime dayEndTime, Set<LocalDate> holidays);  BusinessDateTime(ZonedDateTime dateTime, Set<LocalDate> holidays);  BusinessDateTime(Set<LocalDate> holidays);  BusinessDateTime(ZonedDateTime dateTime, LocalTime dayStartTime, LocalTime dayEndTime);  BusinessDateTime(LocalTime dayStartTime, LocalTime dayEndTime);  BusinessDateTime(ZonedDateTime dateTime);  BusinessDateTime(); @Override ChronoLocalDateTime<LocalDate> toLocalDateTime(); @Override ZoneOffset getOffset(); @Override ZoneId getZone(); @Override ChronoZonedDateTime<LocalDate> withEarlierOffsetAtOverlap(); @Override ChronoZonedDateTime<LocalDate> withLaterOffsetAtOverlap(); @Override ChronoZonedDateTime<LocalDate> withZoneSameLocal(ZoneId zone); @Override ChronoZonedDateTime<LocalDate> withZoneSameInstant(ZoneId zone); @Override ChronoZonedDateTime<LocalDate> with(TemporalField field, long newValue); @Override ChronoZonedDateTime<LocalDate> plus(long amountToAdd, TemporalUnit unit); @Override long until(Temporal endExclusive, TemporalUnit unit); @Override boolean isSupported(TemporalField field); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); ZonedDateTime toZonedDateTime(); BusinessDateTime plusYears(long years); BusinessDateTime minusYears(long years); BusinessDateTime plusMonths(long months); BusinessDateTime minusMonths(long months); BusinessDateTime plusWeeks(long weeks); BusinessDateTime minusWeeks(long weeks); BusinessDateTime plusDays(long days); BusinessDateTime minusDays(long days); BusinessDateTime plusHours(long hours); BusinessDateTime minusHours(long hours); BusinessDateTime plusMinutes(long minutes); BusinessDateTime minusMinutes(long minutes); BusinessDateTime plusSeconds(long seconds); BusinessDateTime minusSeconds(long seconds); BusinessDateTime plusNanos(long nanos); BusinessDateTime minusNanos(long nanos); BusinessDateTime withYear(int year); BusinessDateTime withMonth(int month); BusinessDateTime withDayOfMonth(int dayOfMonth); BusinessDateTime withDayOfYear(int dayOfYear); BusinessDateTime withHour(int hour); BusinessDateTime withMinute(int minute); BusinessDateTime withSecond(int second); BusinessDateTime withNano(int nanoOfSecond); BusinessDateTime withBusinessDayStartTime(LocalTime time); BusinessDateTime withBusinessDayEndTime(LocalTime time); BusinessDateTime withHolidays(Set<LocalDate> dates); BusinessDateTime withWorkingWeek(WorkingWeek week);  }
@Test public void toZonedDateTime_InBusinessHours_SameTime() { ZonedDateTime expected = ZonedDateTime.of(2014, 12, 12, 11, 34, 56, 756, ZoneId.systemDefault()); BusinessDateTime businessTime = new BusinessDateTime(expected); assertEquals("Friday 11:34:56.756 should equal Friday 11:34:56.756", expected, businessTime.toZonedDateTime()); }
@Test public void toZonedDateTime_AfterBusinessHours_StartNextDay() { ZonedDateTime start = ZonedDateTime.of(2014, 12, 11, 18, 34, 56, 756, ZoneId.systemDefault()); ZonedDateTime expected = ZonedDateTime.of(2014, 12, 12, 9, 0, 0, 0, ZoneId.systemDefault()); BusinessDateTime businessTime = new BusinessDateTime(start); assertEquals("Thursday 18:34:56.756 should equal Friday 9:00:00.0", expected, businessTime.toZonedDateTime()); }
@Test public void toZonedDateTime_BeforeBusinessHours_StartOfDay() { ZonedDateTime start = ZonedDateTime.of(2014, 12, 12, 5, 34, 56, 756, ZoneId.systemDefault()); ZonedDateTime expected = ZonedDateTime.of(2014, 12, 12, 9, 0, 0, 0, ZoneId.systemDefault()); BusinessDateTime businessTime = new BusinessDateTime(start); assertEquals("Friday 5:34:56.756 should equal Friday 9:00:00.0", expected, businessTime.toZonedDateTime()); }
@Test public void toZonedDateTime_AfterBusinessHoursFriday_StartMonday() { ZonedDateTime start = ZonedDateTime.of(2014, 12, 12, 18, 34, 56, 756, ZoneId.systemDefault()); ZonedDateTime expected = ZonedDateTime.of(2014, 12, 15, 9, 0, 0, 0, ZoneId.systemDefault()); BusinessDateTime businessTime = new BusinessDateTime(start); assertEquals("Friday 18:34:56.756 should equal Monday 9:00:00.0", expected, businessTime.toZonedDateTime()); }
@Test public void toZonedDateTime_Weekend_StartMonday() { ZonedDateTime start = ZonedDateTime.of(2014, 12, 13, 14, 34, 56, 756, ZoneId.systemDefault()); ZonedDateTime expected = ZonedDateTime.of(2014, 12, 15, 9, 0, 0, 0, ZoneId.systemDefault()); BusinessDateTime businessTime = new BusinessDateTime(start); assertEquals("Saturday 14:34:56.756 should equal Monday 9:00:00.0", expected, businessTime.toZonedDateTime()); }
@Test public void toZonedDateTime_Holiday_StartNextWorkingDay() { ZonedDateTime start = ZonedDateTime.of(2014, 12, 10, 14, 34, 56, 756, ZoneId.systemDefault()); ZonedDateTime expected = ZonedDateTime.of(2014, 12, 12, 9, 0, 0, 0, ZoneId.systemDefault()); Set<LocalDate> holidays = new HashSet<LocalDate>() {{ add(LocalDate.of(2014, 12, 10)); add(LocalDate.of(2014, 12, 11)); }}; BusinessDateTime businessTime = new BusinessDateTime(start, holidays); assertEquals("Holiday Wednesday + Thursday should equal Friday 9:00:00.0", expected, businessTime.toZonedDateTime()); }