DelayedDailyPathComputer implements Function<Temporal, String> { @Override public String apply(Temporal localDateTime) { Temporal actualDayBucket = localDateTime.minus(graceDelay); return DateTimeFormatter.ofPattern("YYYY-MM-dd").format(actualDayBucket); } DelayedDailyPathComputer(TemporalAmount temporalDelay); @Override String apply(Temporal localDateTime);  }
@Test public void sameDay() { DelayedDailyPathComputer computer = new DelayedDailyPathComputer(Duration.ofHours(2)); Assert.assertEquals("1987-08-13", computer.apply(LocalDateTime.parse("1987-08-13T14:00:00"))); Assert.assertEquals("1987-08-13", computer.apply(LocalDateTime.parse("1987-08-13T02:00:00"))); }
@Test public void dayBefore() { DelayedDailyPathComputer computer = new DelayedDailyPathComputer(Duration.ofHours(2)); Assert.assertEquals("1987-08-12", computer.apply(LocalDateTime.parse("1987-08-13T00:00:00"))); Assert.assertEquals("1987-08-12", computer.apply(LocalDateTime.parse("1987-08-13T01:59:59"))); }