use of com.cronutils.model.SingleCron in project cron-utils by jmrozanec.
the class CronDescriptorTest method testNthDayOfWeekInMonth.
@Test
public void testNthDayOfWeekInMonth() {
final int dayOfWeek = 2;
final int hour = 10;
final int minute = 15;
final List<CronField> results = new ArrayList<>();
results.add(new CronField(CronFieldName.HOUR, new On(new IntegerFieldValue(hour)), nullFieldConstraints));
results.add(new CronField(CronFieldName.MINUTE, new On(new IntegerFieldValue(minute)), nullFieldConstraints));
results.add(new CronField(CronFieldName.DAY_OF_WEEK, new On(new IntegerFieldValue(dayOfWeek), new SpecialCharFieldValue(SpecialChar.HASH), new IntegerFieldValue(dayOfWeek)), nullFieldConstraints));
assertEquals(String.format("at %s:%s Tuesday %s of every month", hour, minute, dayOfWeek), descriptor.describe(new SingleCron(mockDefinition, results)));
}
use of com.cronutils.model.SingleCron in project cron-utils by jmrozanec.
the class CronDescriptorTest method testDescribeAtXTimeBetweenDaysOfWeek.
@Test
public void testDescribeAtXTimeBetweenDaysOfWeek() {
final int hour = 11;
final int minute = 30;
final int start = 2;
final int end = 6;
final Between expression = new Between(new IntegerFieldValue(start), new IntegerFieldValue(end));
final List<CronField> results = new ArrayList<>();
results.add(new CronField(CronFieldName.HOUR, new On(new IntegerFieldValue(hour)), nullFieldConstraints));
results.add(new CronField(CronFieldName.MINUTE, new On(new IntegerFieldValue(minute)), nullFieldConstraints));
results.add(new CronField(CronFieldName.DAY_OF_WEEK, expression, nullFieldConstraints));
assertEquals(String.format("at %s:%s every day between Tuesday and Saturday", hour, minute), descriptor.describe(new SingleCron(mockDefinition, results)));
}
use of com.cronutils.model.SingleCron in project cron-utils by jmrozanec.
the class CronDescriptorTest method testLastDayOfWeekInMonth.
@Test
public void testLastDayOfWeekInMonth() {
final int dayOfWeek = 2;
final int hour = 10;
final int minute = 15;
final List<CronField> results = new ArrayList<>();
results.add(new CronField(CronFieldName.HOUR, new On(new IntegerFieldValue(hour)), nullFieldConstraints));
results.add(new CronField(CronFieldName.MINUTE, new On(new IntegerFieldValue(minute)), nullFieldConstraints));
results.add(new CronField(CronFieldName.DAY_OF_WEEK, new On(new IntegerFieldValue(dayOfWeek), new SpecialCharFieldValue(SpecialChar.L)), nullFieldConstraints));
assertEquals(String.format("at %s:%s last Tuesday of every month", hour, minute), descriptor.describe(new SingleCron(mockDefinition, results)));
}
Aggregations