CronJobTrigger implements JobTrigger { public int[] getHours() { return hours; } CronJobTrigger();  CronJobTrigger(String entry); @Override Object clone(); void reset(); Date getNextExecutionAfter(Date date); void triggered(Date date); int[] getMinutes(); void setMinutes(int[] minutes); void setMinutes(String minutes); int[] getHours(); void setHours(int[] hours); void setHours(String hours); int[] getMonths(); void setMonths(int[] months); void setMonths(String months); int[] getDaysOfMonth(); void setDaysOfMonth(int[] daysOfMonth); void setDaysOfMonth(String daysOfMonth); int[] getDaysOfWeek(); void setDaysOfWeek(int[] daysOfWeek); void setDaysOfWeek(String daysOfWeek); Object getCronExpression(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testGetHours() { assertEquals(24, minuteTrigger.getHours().length); assertEquals(2, hourTrigger.getHours().length); assertEquals(1, dayOfMonthTrigger.getHours().length); assertEquals(1, monthTrigger.getHours().length); assertEquals(1, dayOfWeekTrigger.getHours().length); for (int i = 0; i < hours.length; i++) assertEquals(hours[i], hourTrigger.getHours()[i]); }
@Test public void testModuloOperator() { CronJobTrigger trigger = new CronJobTrigger("* */3 * * *"); assertEquals(8, trigger.getHours().length); assertEquals(0, trigger.getHours()[0]); assertEquals(3, trigger.getHours()[1]); assertEquals(6, trigger.getHours()[2]); assertEquals(9, trigger.getHours()[3]); assertEquals(12, trigger.getHours()[4]); assertEquals(15, trigger.getHours()[5]); assertEquals(18, trigger.getHours()[6]); assertEquals(21, trigger.getHours()[7]); }
@Test public void testCommaOperator() { CronJobTrigger trigger = new CronJobTrigger("* 1,3 * * *"); assertEquals(2, trigger.getHours().length); assertEquals(1, trigger.getHours()[0]); assertEquals(3, trigger.getHours()[1]); }
@Test public void testRangeOperator() { CronJobTrigger trigger = new CronJobTrigger("* 1-3 * * *"); assertEquals(3, trigger.getHours().length); assertEquals(1, trigger.getHours()[0]); assertEquals(2, trigger.getHours()[1]); assertEquals(3, trigger.getHours()[2]); }