CronJobSimpleExpressionBuilder { public String build() { String day = dayOfMonth == 0 ? "*" : "*/" + dayOfMonth; return String.format(CRON_JOB_EXPR, startTime.getMinute(), startTime.getHour(), day); } CronJobSimpleExpressionBuilder(Time startTime); CronJobSimpleExpressionBuilder withRepeatIntervalInDays(int repeatIntervalInDays); String build();  }
@Test public void testBuild() { CronJobSimpleExpressionBuilder builder = new CronJobSimpleExpressionBuilder(new Time(10, 25)); assertEquals("0 25 10 * * ?", builder.build()); }
@Test public void shouldScheduleJobEverySevenDays() { SimpleTrigger trigger = newTrigger() .withIdentity(triggerKey("triggerName", "groupName")) .startNow() .withSchedule(simpleSchedule() .withIntervalInHours(7 * 24) .repeatForever()) .build(); LocalDate today = DateUtil.today(); Date yesterday = today.plusDays(-1).toDate(); Date firstFireTime = trigger.getFireTimeAfter(yesterday); Date secondFireTime = trigger.getFireTimeAfter(firstFireTime); Date thirdFireTime = trigger.getFireTimeAfter(secondFireTime); assertEquals(Duration.standardDays(7).getMillis(), secondFireTime.getTime() - firstFireTime.getTime()); assertEquals(Duration.standardDays(7).getMillis(), thirdFireTime.getTime() - secondFireTime.getTime()); }