Skip to content

Commit 72895f0

Browse files
committed
Add test for combination of fixed date fields
Added test for a fixed day-of-week and day-of-month combination. With the new CronExpression in place, this failure does not occur anymore. Closes gh-13621
1 parent 87c3bb5 commit 72895f0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spring-context/src/test/java/org/springframework/scheduling/support/CronExpressionTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,17 @@ void monthSequence() {
431431
assertThat(expression.next(last)).isEqualTo(expected);
432432
}
433433

434+
@Test
435+
public void fixedDays() {
436+
CronExpression expression = CronExpression.parse("0 0 0 29 2 WED");
437+
438+
LocalDateTime last = LocalDateTime.of(2012, 2, 29, 1, 0);
439+
assertThat(last.getDayOfWeek()).isEqualTo(WEDNESDAY);
440+
441+
LocalDateTime actual = expression.next(last);
442+
assertThat(actual).isNotNull();
443+
assertThat(actual.getDayOfMonth()).isEqualTo(29);
444+
assertThat(actual.getDayOfWeek()).isEqualTo(WEDNESDAY);
445+
}
446+
434447
}

0 commit comments

Comments
 (0)