use of com.cronutils.model.field.value.SpecialCharFieldValue 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.SpecialCharFieldValue 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.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class ValidationFieldExpressionVisitorTest method testIsDefault.
@Test
public void testIsDefault() {
final SpecialCharFieldValue nonIntegerFieldValue = new SpecialCharFieldValue(SpecialChar.LW);
assertFalse(strictVisitor.isDefault(nonIntegerFieldValue));
assertFalse(visitor.isDefault(nonIntegerFieldValue));
IntegerFieldValue integerValue = new IntegerFieldValue(DEFAULT_INT);
assertTrue(strictVisitor.isDefault(integerValue));
assertTrue(visitor.isDefault(integerValue));
integerValue = new IntegerFieldValue(0);
assertFalse(strictVisitor.isDefault(integerValue));
assertFalse(visitor.isDefault(integerValue));
integerValue = new IntegerFieldValue(99);
assertFalse(strictVisitor.isDefault(integerValue));
assertFalse(visitor.isDefault(integerValue));
integerValue = new IntegerFieldValue(-99);
assertFalse(strictVisitor.isDefault(integerValue));
assertFalse(visitor.isDefault(integerValue));
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class ValidationFieldExpressionVisitorTest method testIsSpecialCharNotL.
@Test
public void testIsSpecialCharNotL() {
SpecialCharFieldValue specialCharFieldValue;
for (final SpecialChar sp : SpecialChar.values()) {
specialCharFieldValue = new SpecialCharFieldValue(sp);
if (sp == SpecialChar.L) {
assertFalse(strictVisitor.isSpecialCharNotL(specialCharFieldValue));
assertFalse(visitor.isSpecialCharNotL(specialCharFieldValue));
} else {
assertTrue(strictVisitor.isSpecialCharNotL(specialCharFieldValue));
assertTrue(visitor.isSpecialCharNotL(specialCharFieldValue));
}
}
}
use of com.cronutils.model.field.value.SpecialCharFieldValue in project cron-utils by jmrozanec.
the class ValidationFieldExpressionVisitorTest method testIsInRange.
@Test
public void testIsInRange() {
final SpecialCharFieldValue nonIntegerFieldValue = new SpecialCharFieldValue(SpecialChar.LW);
strictVisitor.isInRange(nonIntegerFieldValue);
visitor.isInRange(nonIntegerFieldValue);
final IntegerFieldValue integerValue = new IntegerFieldValue(5);
strictVisitor.isInRange(integerValue);
visitor.isInRange(integerValue);
}
Aggregations