@Test public void testValidSchedule() { clock.advance(Amount.of(1L, Time.DAYS)); Date expectedPrediction = new Date(Amount.of(1L, Time.DAYS).as(Time.MILLISECONDS) + Amount.of(1L, Time.MINUTES).as(Time.MILLISECONDS)); assertEquals( Optional.of(expectedPrediction), cronPredictor.predictNextRun(CrontabEntry.parse("* * * * *"))); }
@Override public Optional<Date> predictNextRun(CrontabEntry schedule) { CronExpression cronExpression = Quartz.cronExpression(schedule, timeZone); return Optional.fromNullable(cronExpression.getNextValidTimeAfter(new Date(clock.nowMillis()))); }
CronPredictorImpl implements CronPredictor { @Override public Optional<Date> predictNextRun(CrontabEntry schedule) { CronExpression cronExpression = Quartz.cronExpression(schedule, timeZone); return Optional.fromNullable(cronExpression.getNextValidTimeAfter(new Date(clock.nowMillis()))); } }
CronPredictorImpl implements CronPredictor { @Override public Optional<Date> predictNextRun(CrontabEntry schedule) { CronExpression cronExpression = Quartz.cronExpression(schedule, timeZone); return Optional.fromNullable(cronExpression.getNextValidTimeAfter(new Date(clock.nowMillis()))); } @Inject  CronPredictorImpl(Clock clock, TimeZone timeZone); }
CronPredictorImpl implements CronPredictor { @Override public Optional<Date> predictNextRun(CrontabEntry schedule) { CronExpression cronExpression = Quartz.cronExpression(schedule, timeZone); return Optional.fromNullable(cronExpression.getNextValidTimeAfter(new Date(clock.nowMillis()))); } @Inject  CronPredictorImpl(Clock clock, TimeZone timeZone); @Override Optional<Date> predictNextRun(CrontabEntry schedule); }
CronPredictorImpl implements CronPredictor { @Override public Optional<Date> predictNextRun(CrontabEntry schedule) { CronExpression cronExpression = Quartz.cronExpression(schedule, timeZone); return Optional.fromNullable(cronExpression.getNextValidTimeAfter(new Date(clock.nowMillis()))); } @Inject  CronPredictorImpl(Clock clock, TimeZone timeZone); @Override Optional<Date> predictNextRun(CrontabEntry schedule);  }