@Test public void h1InstantOfNextFrameShouldReturnTheNextHour() { final H1 cut = new H1(); assertThat(cut.instantOfNextFrame(LocalDate.of(7821, Month.NOVEMBER, 24).atTime(4, 59, 0, 0).toInstant(UTC))) .isEqualTo(LocalDate.of(7821, Month.NOVEMBER, 24).atTime(5, 0, 0, 0).toInstant(UTC)); assertThat(cut.instantOfNextFrame(LocalDate.of(1975, Month.FEBRUARY, 10).atTime(14, 59, 0, 0).toInstant(UTC))) .isEqualTo(LocalDate.of(1975, Month.FEBRUARY, 10).atTime(15, 00, 0, 0).toInstant(UTC)); assertThat(cut.instantOfNextFrame(LocalDate.of(2047, Month.MARCH, 7).atTime(16, 29, 0, 0).toInstant(UTC))) .isEqualTo(LocalDate.of(2047, Month.MARCH, 7).atTime(17, 00, 0, 0).toInstant(UTC)); assertThat(cut.instantOfNextFrame(LocalDate.of(2014, Month.SEPTEMBER, 16).atTime(21, 1, 0, 0).toInstant(UTC))) .isEqualTo(LocalDate.of(2014, Month.SEPTEMBER, 16).atTime(22, 00, 0, 0).toInstant(UTC)); assertThat(cut.instantOfNextFrame(LocalDate.of(1257, Month.MAY, 24).atTime(10, 37, 0, 0).toInstant(UTC))) .isEqualTo(LocalDate.of(1257, Month.MAY, 24).atTime(11, 0, 0, 0).toInstant(UTC)); assertThat(cut.instantOfNextFrame(LocalDate.of(2047, Month.NOVEMBER, 24).atTime(4, 0, 0, 0).toInstant(UTC))) .isEqualTo(LocalDate.of(2047, Month.NOVEMBER, 24).atTime(5, 0, 0, 0).toInstant(UTC)); assertThat(cut.instantOfNextFrame(LocalDate.of(2104, Month.OCTOBER, 10).atTime(3, 59, 47, 0).toInstant(UTC))) .isEqualTo(LocalDate.of(2104, Month.OCTOBER, 10).atTime(4, 0, 0, 0).toInstant(UTC)); assertThat( cut.instantOfNextFrame(LocalDate.of(2004, Month.FEBRUARY, 10).atTime(17, 59, 0, 67832).toInstant(UTC))) .isEqualTo(LocalDate.of(2004, Month.FEBRUARY, 10).atTime(18, 0, 0, 0).toInstant(UTC)); assertThat(cut.instantOfNextFrame(LocalDate.of(1947, Month.AUGUST, 10).atTime(13, 59, 25, 4578).toInstant(UTC))) .isEqualTo(LocalDate.of(1947, Month.AUGUST, 10).atTime(14, 0, 0, 0).toInstant(UTC)); }
@Override public Instant instantOfNextFrame(final Instant current) { final OffsetDateTime time = current.atOffset(UTC); return time.withSecond(0).withNano(0).withMinute(0).plusHours(1).toInstant(); }
H1 implements TimeFrame { @Override public Instant instantOfNextFrame(final Instant current) { final OffsetDateTime time = current.atOffset(UTC); return time.withSecond(0).withNano(0).withMinute(0).plusHours(1).toInstant(); } }
H1 implements TimeFrame { @Override public Instant instantOfNextFrame(final Instant current) { final OffsetDateTime time = current.atOffset(UTC); return time.withSecond(0).withNano(0).withMinute(0).plusHours(1).toInstant(); }  }
H1 implements TimeFrame { @Override public Instant instantOfNextFrame(final Instant current) { final OffsetDateTime time = current.atOffset(UTC); return time.withSecond(0).withNano(0).withMinute(0).plusHours(1).toInstant(); }  @Override Instant instantOfNextFrame(final Instant current); @Override boolean areInSameTimeFrame(final Instant instant1, final Instant instant2); }
H1 implements TimeFrame { @Override public Instant instantOfNextFrame(final Instant current) { final OffsetDateTime time = current.atOffset(UTC); return time.withSecond(0).withNano(0).withMinute(0).plusHours(1).toInstant(); }  @Override Instant instantOfNextFrame(final Instant current); @Override boolean areInSameTimeFrame(final Instant instant1, final Instant instant2);  }