|
|
|
|
@ -49,12 +49,12 @@ public class CronTriggerTests {
@@ -49,12 +49,12 @@ public class CronTriggerTests {
|
|
|
|
|
this.timeZone = timeZone; |
|
|
|
|
this.date = date; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Parameters |
|
|
|
|
public static List<Object[]> getParameters() { |
|
|
|
|
List<Object[]> list = new ArrayList<Object[]>(); |
|
|
|
|
list.add(new Object[] {new Date(), TimeZone.getDefault()}); |
|
|
|
|
list.add(new Object[] {new Date(), TimeZone.getTimeZone("CET")}); |
|
|
|
|
list.add(new Object[] { new Date(), TimeZone.getDefault() }); |
|
|
|
|
list.add(new Object[] { new Date(), TimeZone.getTimeZone("CET") }); |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -66,7 +66,6 @@ public class CronTriggerTests {
@@ -66,7 +66,6 @@ public class CronTriggerTests {
|
|
|
|
|
calendar.set(Calendar.MILLISECOND, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Before |
|
|
|
|
public void setUp() { |
|
|
|
|
calendar.setTimeZone(timeZone); |
|
|
|
|
@ -561,6 +560,51 @@ public class CronTriggerTests {
@@ -561,6 +560,51 @@ public class CronTriggerTests {
|
|
|
|
|
assertEquals(trigger1, trigger2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testSecondInvalid() throws Exception { |
|
|
|
|
new CronTrigger("77 * * * * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testSecondRangeInvalid() throws Exception { |
|
|
|
|
new CronTrigger("44-77 * * * * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testMinuteInvalid() throws Exception { |
|
|
|
|
new CronTrigger("* 77 * * * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testMinuteRangeInvalid() throws Exception { |
|
|
|
|
new CronTrigger("* 44-77 * * * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testHourInvalid() throws Exception { |
|
|
|
|
new CronTrigger("* * 27 * * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testHourRangeInvalid() throws Exception { |
|
|
|
|
new CronTrigger("* * 23-28 * * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testDayInvalid() throws Exception { |
|
|
|
|
new CronTrigger("* * * 45 * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testDayRangeInvalid() throws Exception { |
|
|
|
|
new CronTrigger("* * * 28-45 * *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
public void testMonthInvalid() throws Exception { |
|
|
|
|
new CronTrigger("* * * * 11-13 *", timeZone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testWhitespace() throws Exception { |
|
|
|
|
CronTrigger trigger1 = new CronTrigger("* * * * 1 *", timeZone); |
|
|
|
|
@ -579,7 +623,6 @@ public class CronTriggerTests {
@@ -579,7 +623,6 @@ public class CronTriggerTests {
|
|
|
|
|
assertEquals(calendar.getTime(), trigger.nextExecutionTime(context)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static TriggerContext getTriggerContext(Date lastCompletionTime) { |
|
|
|
|
SimpleTriggerContext context = new SimpleTriggerContext(); |
|
|
|
|
context.update(null, null, lastCompletionTime); |
|
|
|
|
|