findings = val.validate(adr);
Assert.assertTrue(findings.size() > 0); // too long
}
public void testOverridesAttributeConstraintIndex() {
CompanyAddress adr = new CompanyAddress("invalid-string");
Validator val = factory.getValidator();
Set<ConstraintViolation<CompanyAddress>> findings = val.validate(adr);
assertEquals(2, findings.size()); // without @ReportAsSingleConstraintViolation
assertNotNull(TestUtils.getViolationWithMessage(findings, "Not COMPANY"));
assertNotNull(TestUtils.getViolationWithMessage(findings, "Not an email"));
adr = new CompanyAddress("JOHN_DO@WEB.DE");
findings = val.validate(adr);
assertEquals(1, findings.size());
assertNotNull(TestUtils.getViolationWithMessage(findings, "Not COMPANY"));
adr = new CompanyAddress("JOHN_DO@COMPANY.DE");
findings = val.validate(adr);
Assert.assertTrue(findings.isEmpty());
}