validator.setDetailMessage("validator.length.detail");
validator.setSummaryMessage("validator.length.summary");
}
@Test()
public void test() {
ValidatorMessage message = (ValidatorMessage) validator.validate("", "");
assertFalse(message.hasError());
validator.setMin( 2L );
message = (ValidatorMessage) validator.validate("Ri", "");
assertFalse("Ri is just two letters and should pass", message.hasError());
validator.setMin( 5L );
message = (ValidatorMessage) validator.validate("Ri", "");
assertTrue("Ri is does not have 5 letters", message.hasError());
validator.setMin( 5L );
message = (ValidatorMessage) validator.validate("", "");
assertTrue("Ri is does not have 5 letters", message.hasError());
validator.setMin( 0L );
validator.setMax( 10L );
message = (ValidatorMessage) validator.validate("RichardMNixonIII", "");
assertTrue(message.hasError());
validator.setMax( 10L );
message = (ValidatorMessage) validator.validate("R", "");
assertFalse(message.hasError());
}