@Test public void m1IinstantsAreInSameTimeFrameWhenTheyAreInTheSameMinute() { final M1 cut = new M1(); assertThat(cut.areInSameTimeFrame(LocalDate.of(2014, Month.JULY, 31).atTime(20, 15, 59, 99999).toInstant(UTC), LocalDate.of(2014, Month.JULY, 31).atTime(20, 15, 0, 0).toInstant(UTC))).isTrue(); assertThat(cut.areInSameTimeFrame(LocalDate.of(2048, Month.FEBRUARY, 8).atTime(9, 16, 42, 123).toInstant(UTC), LocalDate.of(2048, Month.FEBRUARY, 8).atTime(9, 16, 32, 1254).toInstant(UTC))).isTrue(); assertThat(cut.areInSameTimeFrame(LocalDate.of(2014, Month.JULY, 31).atTime(20, 15, 0, 0).toInstant(UTC), LocalDate.of(2014, Month.JULY, 31).atTime(20, 16, 0, 0).toInstant(UTC))).isFalse(); assertThat(cut.areInSameTimeFrame(LocalDate.of(1983, Month.MAY, 12).atTime(12, 56, 54, 0).toInstant(UTC), LocalDate.of(1983, Month.MAY, 12).atTime(12, 57, 54, 0).toInstant(UTC))).isFalse(); assertThat( cut.areInSameTimeFrame(LocalDate.of(2132, Month.SEPTEMBER, 27).atTime(15, 48, 14, 43432).toInstant(UTC), LocalDate.of(2132, Month.SEPTEMBER, 28).atTime(15, 48, 14, 43432).toInstant(UTC))).isFalse(); assertThat(cut.areInSameTimeFrame(LocalDate.of(2004, Month.DECEMBER, 5).atTime(4, 7, 0, 3234).toInstant(UTC), LocalDate.of(2006, Month.DECEMBER, 5).atTime(4, 7, 0, 3234).toInstant(UTC))).isFalse(); }
@Override public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) { final OffsetDateTime localStart = instant1.atOffset(UTC).withSecond(0).withNano(0); final Instant start = localStart.toInstant(); final Instant startOfNext = localStart.plusMinutes(1).toInstant(); return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext)); }
M1 implements TimeFrame { @Override public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) { final OffsetDateTime localStart = instant1.atOffset(UTC).withSecond(0).withNano(0); final Instant start = localStart.toInstant(); final Instant startOfNext = localStart.plusMinutes(1).toInstant(); return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext)); } }
M1 implements TimeFrame { @Override public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) { final OffsetDateTime localStart = instant1.atOffset(UTC).withSecond(0).withNano(0); final Instant start = localStart.toInstant(); final Instant startOfNext = localStart.plusMinutes(1).toInstant(); return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext)); }  }
M1 implements TimeFrame { @Override public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) { final OffsetDateTime localStart = instant1.atOffset(UTC).withSecond(0).withNano(0); final Instant start = localStart.toInstant(); final Instant startOfNext = localStart.plusMinutes(1).toInstant(); return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext)); }  @Override Instant instantOfNextFrame(final Instant current); @Override boolean areInSameTimeFrame(final Instant instant1, final Instant instant2); }
M1 implements TimeFrame { @Override public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) { final OffsetDateTime localStart = instant1.atOffset(UTC).withSecond(0).withNano(0); final Instant start = localStart.toInstant(); final Instant startOfNext = localStart.plusMinutes(1).toInstant(); return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext)); }  @Override Instant instantOfNextFrame(final Instant current); @Override boolean areInSameTimeFrame(final Instant instant1, final Instant instant2);  }