assertTrue(validator.validate(4.1f, new TestValidatorContext("4.1")));
}
public void testMaxValidator() {
MaxValidator validator = new MaxValidator();
assertTrue(validator.validate(null, null));
assertTrue(validator.validate(3, new TestValidatorContext("4")));
assertFalse(validator.validate(4, new TestValidatorContext("3")));
try {
validator.validate(4, new TestValidatorContext("4.4"));
fail("exception expected");
} catch (ProcessEngineException e) {
e.printStackTrace();
assertTrue(e.getMessage().contains("Cannot validate Integer value 4: configuration 4.4 cannot be parsed as Integer."));
}
assertFalse(validator.validate(4.1d, new TestValidatorContext("4")));
assertTrue(validator.validate(4.1d, new TestValidatorContext("4.2")));
assertFalse(validator.validate(4.1f, new TestValidatorContext("4")));
assertTrue(validator.validate(4.1f, new TestValidatorContext("4.2")));
}