use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class FieldValueGeneratorFactoryTest method testForCronFieldOnSpecialCharNotNone.
@Test
public void testForCronFieldOnSpecialCharNotNone() {
final On mockOn = mock(On.class);
for (final SpecialChar s : SpecialChar.values()) {
if (!s.equals(SpecialChar.NONE)) {
boolean gotException = false;
when(mockOn.getSpecialChar()).thenReturn(new SpecialCharFieldValue(s));
when(mockCronField.getExpression()).thenReturn(mockOn);
try {
FieldValueGeneratorFactory.forCronField(mockCronField);
} catch (final RuntimeException e) {
gotException = true;
}
assertTrue("Should get exception when asking for OnValueGenerator with special char", gotException);
}
}
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class FieldValueGeneratorFactoryTest method createDayOfMonthValueGeneratorInstance.
private FieldValueGenerator createDayOfMonthValueGeneratorInstance(final SpecialChar specialChar) {
when(mockCronField.getField()).thenReturn(CronFieldName.DAY_OF_MONTH);
final On mockOn = mock(On.class);
when(mockOn.getSpecialChar()).thenReturn(new SpecialCharFieldValue(specialChar));
when(mockCronField.getExpression()).thenReturn(mockOn);
return FieldValueGeneratorFactory.createDayOfMonthValueGeneratorInstance(mockCronField, 2015, 1);
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class FieldValueGeneratorFactoryTest method testForCronFieldOnSpecialCharNone.
@Test
public void testForCronFieldOnSpecialCharNone() {
final On mockOn = mock(On.class);
when(mockOn.getSpecialChar()).thenReturn(new SpecialCharFieldValue(SpecialChar.NONE));
when(mockCronField.getExpression()).thenReturn(mockOn);
assertEquals(OnFieldValueGenerator.class, FieldValueGeneratorFactory.forCronField(mockCronField).getClass());
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class OnDayOfMonthValueGeneratorLTest method setUp.
@Before
public void setUp() {
final FieldConstraints constraints = FieldConstraintsBuilder.instance().addLSupport().createConstraintsInstance();
fieldValueGenerator = new OnDayOfMonthValueGenerator(new CronField(CronFieldName.DAY_OF_MONTH, new On(new SpecialCharFieldValue(SpecialChar.L)), constraints), YEAR, MONTH);
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class OnTest method testAsStringSpecialCharL.
@Test
public void testAsStringSpecialCharL() {
final String expression = "L";
assertEquals(expression, new On(new SpecialCharFieldValue(SpecialChar.L)).asString());
}
Aggregations