use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class ValidationFieldExpressionVisitorTest method testVisitOn.
@Test
public void testVisitOn() {
On on = new On(new IntegerFieldValue(LOW));
assertEquals(on, on.accept(strictVisitor));
assertEquals(on, on.accept(visitor));
on = new On(new IntegerFieldValue(DEFAULT_INT));
assertEquals(on, on.accept(strictVisitor));
assertEquals(on, on.accept(visitor));
on = new On(new SpecialCharFieldValue(SpecialChar.L));
assertEquals(on, on.accept(strictVisitor));
assertEquals(on, on.accept(visitor));
on = new On(new IntegerFieldValue(LOW), new SpecialCharFieldValue(SpecialChar.L), new IntegerFieldValue(HIGH));
assertEquals(on, on.accept(strictVisitor));
assertEquals(on, on.accept(visitor));
on = new On(new IntegerFieldValue(LOW), new SpecialCharFieldValue(SpecialChar.LW), new IntegerFieldValue(DEFAULT_INT));
assertEquals(on, on.accept(strictVisitor));
assertEquals(on, on.accept(visitor));
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class BetweenTest method testNonNumericRangeSupported.
@Test
public void testNonNumericRangeSupported() {
final SpecialChar specialChar = SpecialChar.L;
final Between between = new Between(new SpecialCharFieldValue(specialChar), new IntegerFieldValue(to));
assertEquals(specialChar, between.getFrom().getValue());
assertEquals(to, between.getTo().getValue());
assertEquals(String.format("%s-%s", specialChar, to), between.asString());
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class FieldValueGeneratorFactoryTest method testCreateDayOfMonthValueGeneratorInstanceBadCronFieldName.
@Test(expected = IllegalArgumentException.class)
public void testCreateDayOfMonthValueGeneratorInstanceBadCronFieldName() {
when(mockCronField.getField()).thenReturn(CronFieldName.YEAR);
final On mockOn = mock(On.class);
// any value except NONE
when(mockOn.getSpecialChar()).thenReturn(new SpecialCharFieldValue(SpecialChar.L));
when(mockCronField.getExpression()).thenReturn(mockOn);
FieldValueGeneratorFactory.createDayOfMonthValueGeneratorInstance(mockCronField, 2015, 1);
}
Aggregations