CronSequenceGenerator explicitly rejects invalid incrementer delta

Issue: SPR-12871
This commit is contained in:
Juergen Hoeller
2015-04-01 16:45:24 +02:00
parent 100d75da26
commit ceb17fcaca
3 changed files with 74 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,4 +46,14 @@ public class CronSequenceGeneratorTests {
new CronSequenceGenerator("0 */2 1-4 * * *").next(new Date(2012, 6, 1, 9, 0)));
}
@Test(expected = IllegalArgumentException.class)
public void testWith0Increment() {
new CronSequenceGenerator("*/0 * * * * *").next(new Date(2012, 6, 1, 9, 0));
}
@Test(expected = IllegalArgumentException.class)
public void testWithNegativeIncrement() {
new CronSequenceGenerator("*/-1 * * * * *").next(new Date(2012, 6, 1, 9, 0));
}
}