Fixed bug in cron test. #58 - patch applied with thanks

This commit is contained in:
gtully 2015-01-26 21:20:03 +00:00
parent bf5a2997c7
commit 60c9d03e1d
1 changed files with 7 additions and 1 deletions

View File

@ -216,13 +216,19 @@ public class CronParserTest {
long current = 20*60*1000; long current = 20*60*1000;
Calendar calender = Calendar.getInstance(); Calendar calender = Calendar.getInstance();
calender.setTimeInMillis(current); calender.setTimeInMillis(current);
int startHours = calender.get(Calendar.HOUR_OF_DAY);
int startMinutes = calender.get(Calendar.MINUTE);
LOG.debug("start:" + calender.getTime()); LOG.debug("start:" + calender.getTime());
long next = CronParser.getNextScheduledTime(test, current); long next = CronParser.getNextScheduledTime(test, current);
calender.setTimeInMillis(next); calender.setTimeInMillis(next);
LOG.debug("next:" + calender.getTime()); LOG.debug("next:" + calender.getTime());
long result = next - current; long result = next - current;
assertEquals(60*10*1000,result); if (startHours == 8 && startMinutes == 50) {
assertEquals(60*40*1000,result);
} else {
assertEquals(60*10*1000,result);
}
} }
@Test @Test