FireOnceJobTrigger implements JobTrigger { public Date getNextExecutionAfter(Date date) { if (fired) { logger.debug("Fired one-time job trigger {} was asked for additional fire dates", this); return null; } else if (fireDate != null && !fireDate.equals(date)) { logger.warn("One-time job trigger {} was asked for additional fire dates", this); return null; } fireDate = new Date(date.getTime() + 1 * Times.MS_PER_SECOND); return date; }  Date getNextExecutionAfter(Date date); @Override Object clone(); void triggered(Date date); void reset(); @Override String toString();  }
@Test public void testGetNextExecutionAfter() { Date now = new Date(); Date then = new Date(now.getTime() + 60000L); assertEquals(now, trigger.getNextExecutionAfter(now)); assertTrue(trigger.getNextExecutionAfter(then) == null); trigger.triggered(now); assertTrue(trigger.getNextExecutionAfter(now) == null); assertTrue(trigger.getNextExecutionAfter(then) == null); }