Add test for Friday 13th crontab failure
Added test for Friday 13th trigger, i.e. an uncommon crontab expression. With the new CronExpression in place, this failure does not occur anymore. Closes gh-21574
This commit is contained in:
parent
72895f0810
commit
dbec16d566
|
|
@ -25,6 +25,7 @@ import java.time.ZonedDateTime;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static java.time.DayOfWeek.FRIDAY;
|
||||
import static java.time.DayOfWeek.MONDAY;
|
||||
import static java.time.DayOfWeek.TUESDAY;
|
||||
import static java.time.DayOfWeek.WEDNESDAY;
|
||||
|
|
@ -444,4 +445,21 @@ class CronExpressionTests {
|
|||
assertThat(actual.getDayOfWeek()).isEqualTo(WEDNESDAY);
|
||||
}
|
||||
|
||||
@Test
|
||||
void friday13th() {
|
||||
CronExpression expression = CronExpression.parse("0 0 0 13 * FRI");
|
||||
|
||||
LocalDateTime last = LocalDateTime.of(2018, 7, 31, 11, 47, 14);
|
||||
LocalDateTime actual = expression.next(last);
|
||||
assertThat(actual).isNotNull();
|
||||
assertThat(actual.getDayOfWeek()).isEqualTo(FRIDAY);
|
||||
assertThat(actual.getDayOfMonth()).isEqualTo(13);
|
||||
|
||||
last = actual;
|
||||
actual = expression.next(last);
|
||||
assertThat(actual).isNotNull();
|
||||
assertThat(actual.getDayOfWeek()).isEqualTo(FRIDAY);
|
||||
assertThat(actual.getDayOfMonth()).isEqualTo(13);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue