@Test public void testIsTriggerWhenTheCurrentTimeEqualsWithTheNextTriggerAndZonesAreEquivalentThenItShouldTriggerAnEvent() { ZoneId zone = ZoneId.systemDefault(); String timeZone = zone.getId(); ZonedDateTime currentZonedTime = ZonedDateTime.of(2017, 12, 20, 12, 0, 0, 0, zone.normalized()); long monitorUpdateRate = 60000L; when(dateTimeService.getDefaultZonedDateTime()).thenReturn(currentZonedTime); when(dateTimeService.getZonedDateTime(currentZonedTime.toInstant(), timeZone)).thenReturn(currentZonedTime); TimeAlert timeAlert = createTimeAlert(timeZone); assertTrue(underTest.isTrigger(timeAlert, monitorUpdateRate)); }
public boolean isTrigger(TimeAlert alert, long monitorUpdateRate) { return isTrigger(alert, monitorUpdateRate, dateTimeService.getDefaultZonedDateTime()); }
DateService { public boolean isTrigger(TimeAlert alert, long monitorUpdateRate) { return isTrigger(alert, monitorUpdateRate, dateTimeService.getDefaultZonedDateTime()); } }
DateService { public boolean isTrigger(TimeAlert alert, long monitorUpdateRate) { return isTrigger(alert, monitorUpdateRate, dateTimeService.getDefaultZonedDateTime()); }  }
DateService { public boolean isTrigger(TimeAlert alert, long monitorUpdateRate) { return isTrigger(alert, monitorUpdateRate, dateTimeService.getDefaultZonedDateTime()); }  boolean isTrigger(TimeAlert alert, long monitorUpdateRate); boolean isTrigger(TimeAlert alert, long monitorUpdateRate, ZonedDateTime currentTime); CronSequenceGenerator getCronExpression(String cron); void validateTimeZone(String timeZone); }
DateService { public boolean isTrigger(TimeAlert alert, long monitorUpdateRate) { return isTrigger(alert, monitorUpdateRate, dateTimeService.getDefaultZonedDateTime()); }  boolean isTrigger(TimeAlert alert, long monitorUpdateRate); boolean isTrigger(TimeAlert alert, long monitorUpdateRate, ZonedDateTime currentTime); CronSequenceGenerator getCronExpression(String cron); void validateTimeZone(String timeZone); static final int DAY_OF_WEEK_FIELD; static final int MINIMAL_CRON_SEGMENT_LENGTH; static final int MINIMAL_USER_DEFINED_CRON_SEGMENT_LENGTH; }