use of org.springframework.scheduling.TriggerContext in project spring-framework by spring-projects.
the class CronTriggerTests method incrementMonth.
@ParameterizedCronTriggerTest
void incrementMonth(Date localDateTime, TimeZone timeZone) {
setup(localDateTime, timeZone);
CronTrigger trigger = new CronTrigger("0 0 0 1 * *", timeZone);
this.calendar.set(Calendar.MONTH, 9);
this.calendar.set(Calendar.DAY_OF_MONTH, 30);
Date localDate = this.calendar.getTime();
this.calendar.set(Calendar.DAY_OF_MONTH, 1);
this.calendar.set(Calendar.HOUR_OF_DAY, 0);
this.calendar.set(Calendar.MINUTE, 0);
this.calendar.set(Calendar.SECOND, 0);
this.calendar.set(Calendar.MONTH, 10);
TriggerContext context1 = getTriggerContext(localDate);
Object actual = localDate = trigger.nextExecutionTime(context1);
assertThat(actual).isEqualTo(this.calendar.getTime());
this.calendar.set(Calendar.MONTH, 11);
TriggerContext context2 = getTriggerContext(localDate);
assertThat(trigger.nextExecutionTime(context2)).isEqualTo(this.calendar.getTime());
}
Aggregations