use of org.hibernate.validator.test.internal.engine.valueextraction.model.Entity2 in project hibernate-validator by hibernate.
the class MostSpecificValueExtractorTest method parallelValueExtractorDefinitionsCausesException.
@Test
@TestForIssue(jiraKey = "HV-1306")
public void parallelValueExtractorDefinitionsCausesException() throws Exception {
Validator validator = Validation.byProvider(HibernateValidator.class).configure().addValueExtractor(new IWrapper21ValueExtractor()).addValueExtractor(new IWrapper211ValueExtractor()).addValueExtractor(new IWrapper212ValueExtractor()).addValueExtractor(new IWrapper22ValueExtractor()).addValueExtractor(new IWrapper221ValueExtractor()).buildValidatorFactory().getValidator();
try {
validator.validate(new Entity2(null));
fail("An exception should have been thrown");
} catch (ConstraintDeclarationException e) {
String message = e.getMessage();
assertThat(message).startsWith("HV000219");
assertThat(message).contains(Wrapper2.class.getName());
assertThat(message).contains(IWrapper21ValueExtractor.class.getName());
assertThat(message).doesNotContain(IWrapper211ValueExtractor.class.getName());
assertThat(message).doesNotContain(IWrapper212ValueExtractor.class.getName());
assertThat(message).contains(IWrapper22ValueExtractor.class.getName());
assertThat(message).doesNotContain(IWrapper221ValueExtractor.class.getName());
}
}
Aggregations