use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class OnTest method testAsStringSpecialCharW.
@Test
public void testAsStringSpecialCharW() {
final String expression = "1W";
assertEquals(expression, new On(new IntegerFieldValue(1), new SpecialCharFieldValue(SpecialChar.W)).asString());
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class OnTest method testAsStringJustNumber.
@Test
public void testAsStringJustNumber() {
final int expression = 3;
assertEquals(String.format("%s", expression), new On(new IntegerFieldValue(expression)).asString());
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class OnTest method testAsStringSpecialCharLWithNth.
@Test
public void testAsStringSpecialCharLWithNth() {
final String expression = "L-3";
assertEquals(expression, new On(new IntegerFieldValue(-1), new SpecialCharFieldValue(SpecialChar.L), new IntegerFieldValue(3)).asString());
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class OnTest method testAsStringWithNth.
@Test
public void testAsStringWithNth() {
final int first = 3;
final int second = 4;
final String expression = String.format("%s#%s", first, second);
assertEquals(expression, new On(new IntegerFieldValue(first), new SpecialCharFieldValue(SpecialChar.HASH), new IntegerFieldValue(second)).asString());
}
use of com.cronutils.model.field.value.IntegerFieldValue in project cron-utils by jmrozanec.
the class ValidationFieldExpressionVisitorTest method testVisitEvery.
@Test
public void testVisitEvery() {
Every every = new Every(new IntegerFieldValue(MIDDLE));
final ValidationFieldExpressionVisitor spy = Mockito.spy(visitor);
final ValidationFieldExpressionVisitor strictSpy = Mockito.spy(strictVisitor);
assertEquals(every, every.accept(spy));
assertEquals(every, every.accept(strictSpy));
final Between between = new Between(new IntegerFieldValue(LOW), new IntegerFieldValue(MIDDLE));
every = new Every(between, new IntegerFieldValue(HIGH));
assertEquals(every, every.accept(spy));
assertEquals(every, every.accept(strictSpy));
between.accept(verify(spy, times(1)));
between.accept(verify(strictSpy, times(1)));
final On on = new On(new IntegerFieldValue(LOW));
every = new Every(on, new IntegerFieldValue(HIGH));
assertEquals(every, every.accept(spy));
assertEquals(every, every.accept(strictSpy));
on.accept(verify(spy, times(1)));
on.accept(verify(strictSpy, times(1)));
}
Aggregations