use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class AndFieldValueGeneratorTest method setUp.
@Before
public void setUp() {
constraints = FieldConstraintsBuilder.instance().createConstraintsInstance();
fieldValueGenerator = new AndFieldValueGenerator(new CronField(CronFieldName.MONTH, new And().and(new On(new IntegerFieldValue(VALUE0))).and(new On(new IntegerFieldValue(VALUE1))).and(new On(new IntegerFieldValue(VALUE2))), constraints));
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class CronDescriptorTest method testLastDayOfMonth.
@Test
public void testLastDayOfMonth() {
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_MONTH, new On(new SpecialCharFieldValue(SpecialChar.L)), nullFieldConstraints));
assertEquals(String.format("at %s:%s last day of month", hour, minute), descriptor.describe(new SingleCron(mockDefinition, results)));
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class CronDescriptorTest method testDescribeAtXHours.
@Test
public void testDescribeAtXHours() {
final int hour = 11;
final List<CronField> results = new ArrayList<>();
results.add(new CronField(CronFieldName.HOUR, new On(new IntegerFieldValue(hour)), nullFieldConstraints));
results.add(new CronField(CronFieldName.MINUTE, FieldExpression.always(), nullFieldConstraints));
results.add(new CronField(CronFieldName.SECOND, FieldExpression.always(), nullFieldConstraints));
assertEquals(String.format("at %s:00", hour), descriptor.describe(new SingleCron(mockDefinition, results)));
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class CronDescriptorTest method testEveryMinuteBetweenMonths.
@Test
public void testEveryMinuteBetweenMonths() {
final int monthStart = 2;
final int monthEnd = 3;
final List<CronField> results = new ArrayList<>();
results.add(new CronField(CronFieldName.HOUR, FieldExpression.always(), nullFieldConstraints));
results.add(new CronField(CronFieldName.MINUTE, FieldExpression.always(), nullFieldConstraints));
results.add(new CronField(CronFieldName.MONTH, new Between(new IntegerFieldValue(monthStart), new IntegerFieldValue(monthEnd)), nullFieldConstraints));
assertEquals("every minute every month between February and March", descriptor.describe(new SingleCron(mockDefinition, results)));
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class CronDescriptorTest method testNearestWeekdayToNthOfMonth.
@Test
public void testNearestWeekdayToNthOfMonth() {
final int dayOfMonth = 22;
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_MONTH, new On(new IntegerFieldValue(dayOfMonth), new SpecialCharFieldValue(SpecialChar.W)), nullFieldConstraints));
assertEquals(String.format("at %s:%s the nearest weekday to the %s of the month", hour, minute, dayOfMonth), descriptor.describe(new SingleCron(mockDefinition, results)));
}
Aggregations