Field field = BeanToBeValidated.class.getDeclaredField("field");
field.setAccessible(true);
FakeConstraint constraint = field.getAnnotation(FakeConstraint.class);
{
AnnotationMessageProducer producer = new AnnotationMessageProducer(constraint);
ValidationMessage validationMessage = producer.getMessage(Errors.ANY);
Assert.assertEquals(constraint.message(), validationMessage.getMessage());
}
{
AnnotationMessageProducer producer = new AnnotationMessageProducer(constraint);
ValidationMessage validationMessage = producer.getMessage(Errors.OTHER);
Assert.assertEquals(constraint.message(), validationMessage.getMessage());
}
}