TimeDelay implements Serializable, Comparable<TimeDelay> { public static TimeDelay computeFrom(LocalTime expectedTime, LocalTime effectiveTime) { TimeDelay result = null; if (expectedTime != null) { Long delay = Delays.computeDelay(expectedTime, effectiveTime); result = new TimeDelay(expectedTime, delay); } return result; } private  TimeDelay(); private  TimeDelay(LocalTime expectedTime, Long delay); static TimeDelay now(); static TimeDelay of(LocalTime expectedTime); static TimeDelay of(LocalTime expectedTime, Long delay); static TimeDelay of(LocalTime expectedTime, Long delay, TemporalUnit unit); static TimeDelay computeFrom(LocalTime expectedTime, LocalTime effectiveTime); static TimeDelay from(TimeDelay timeDelay); static TimeDelay fromWithoutDelay(TimeDelay expectedTime); TimeDelay withDelay(Long delay); boolean isAfter(TimeDelay target); boolean isBefore(TimeDelay target); LocalTime getEffectiveTime(); LocalDateTime atDate(LocalDate date); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(TimeDelay target); final LocalTime getExpectedTime(); final long getDelay();  }
@Test public void testComputeFrom() { LocalTime expectedTime = LocalTime.parse("18:00"); LocalTime effectiveTime = LocalTime.parse("18:30"); TimeDelay expected = TimeDelay.of(LocalTime.parse("18:00"), 30L, ChronoUnit.MINUTES); TimeDelay actual = expected.computeFrom(expectedTime, effectiveTime); Assert.assertEquals(expected, actual); Assert.assertEquals(expectedTime, actual.getExpectedTime()); Assert.assertEquals(effectiveTime, actual.getEffectiveTime()); }