factory = Validation.buildDefaultValidatorFactory();
}
public void testMetaDataAPI_ComposedConstraints() {
Validator addressValidator = factory.getValidator();
ElementDescriptor ed =
addressValidator.getConstraintsForClass(FrenchAddress.class)
.getConstraintsForProperty("zipCode");
Assert.assertEquals(1, ed.getConstraintDescriptors().size());
for (ConstraintDescriptor cd : ed.getConstraintDescriptors()) {
Assert.assertTrue(cd.isReportAsSingleViolation());
Assert.assertEquals(3, cd.getComposingConstraints().size());
Assert.assertTrue("no composing constraints found!!",
!cd.getComposingConstraints().isEmpty());
processConstraintDescriptor(cd); //check all constraints on zip code