SimpleCron { public static SimpleCron compile(final String expression) { return new SimpleCron(expression); } private  SimpleCron(final String expression); static SimpleCron compile(final String expression); Scheduler createScheduler(); Long getNextTime(final Long millis); Long getLastTime(final Long millis); @Override String toString(); final static String CRON_ANY; }
@Test public void testUnderLoadTypical() throws ParseException { SimpleCronScheduler executor = new SimpleCronScheduler(SimpleCron.compile("0 0 *")) { @Override protected Long getCurrentTime() { return currentTime; } }; currentTime = DateUtil.parseNormalDateTimeString("2010-03-29T14:00:00.000Z"); Assert.assertFalse(executor.execute()); Assert.assertFalse(executor.execute()); currentTime = DateUtil.parseNormalDateTimeString("2010-03-29T14:01:10.000Z"); Assert.assertFalse(executor.execute()); currentTime = DateUtil.parseNormalDateTimeString("2010-03-29T14:02:11.000Z"); Assert.assertFalse(executor.execute()); currentTime = DateUtil.parseNormalDateTimeString("2010-03-29T23:59:59.999Z"); Assert.assertFalse(executor.execute()); currentTime = DateUtil.parseNormalDateTimeString("2010-03-30T01:59:59.999Z"); Assert.assertTrue(executor.execute()); Assert.assertFalse(executor.execute()); }