@Test public void testLastExecution() throws Exception { DateTime now = truncateToSeconds(DateTime.now()); DateTime expected = truncateToSeconds(now.minusSeconds(1)); ExecutionTime executionTime = ExecutionTime.forCron(quartzCronParser.parse(EVERY_SECOND)); assertEquals(expected, executionTime.lastExecution(now)); }
/** Issue #30: execution time properly calculated */ @Test public void testSaturdayExecutionTime() { DateTime now = DateTime.now(); CronParser parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ)); ExecutionTime executionTime = ExecutionTime.forCron(parser.parse("0 0 3 ? * 6")); DateTime last = executionTime.lastExecution(now); DateTime next = executionTime.nextExecution(now); assertNotEquals(last, next); }