allowedFormats.add("dd MMM yyyy");
allowedFormats.add("d MMM yyyy");
// carry out validation
DatePatternConstraint constraint = new DatePatternConstraint();
constraint.setAllowedFormats(allowedFormats);
ConstraintValidationResult result = processor.process(
dictionaryValidationResult, date, constraint,
attributeValueReader).getFirstConstraintValidationResult();
// assertions
log.info(ToStringBuilder.reflectionToString(dictionaryValidationResult));
assertEquals("number of warnings differs", 0,
dictionaryValidationResult.getNumberOfWarnings());
assertEquals("number of errors differs", 0,
dictionaryValidationResult.getNumberOfErrors());
assertEquals("error level differs", ErrorLevel.OK, result.getStatus());
assertEquals("constraint name differs",
new ValidCharactersConstraintProcessor().getName(),
result.getConstraintName());
}