Assert.assertFalse(tooLong);
verify(context).buildConstraintViolationWithTemplate("Value is too long");
}
private LengthValidator initializeValidator(Class<?> classWithAnnotation) throws NoSuchFieldException {
Length constraint = classWithAnnotation.getField("field").getAnnotation(Length.class);
LengthValidator validator = new LengthValidator();
validator.initialize(constraint);
return validator;
}