@Test @SpecAssertion(section = Sections.CONSTRAINTSDEFINITIONIMPLEMENTATION_CONSTRAINTCOMPOSITION, id = "d") @SpecAssertion(section = Sections.CONSTRAINTSDEFINITIONIMPLEMENTATION_CONSTRAINTCOMPOSITION, id = "e") public void testGroupsDefinedOnMainAnnotationAreInherited() { FrenchAddress address = getFrenchAddressWithoutZipCode(); Set<ConstraintViolation<FrenchAddress>> constraintViolations = getValidator().validate( address ); assertNumberOfViolations( constraintViolations, 1 ); ConstraintViolation<FrenchAddress> constraintViolation = constraintViolations.iterator().next(); assertCorrectConstraintTypes( constraintViolations, NotNull.class ); NotNull notNull = (NotNull) constraintViolation.getConstraintDescriptor().getAnnotation(); List<Class<?>> groups = Arrays.asList( notNull.groups() ); assertTrue( groups.size() == 2, "There should be two groups" ); assertTrue( groups.contains( Default.class ), "The default group should be in the list." ); assertTrue( groups.contains( FrenchAddress.FullAddressCheck.class ), "The FrenchAddress.FullAddressCheck group should be inherited." ); }
@Test @SpecAssertions({ @SpecAssertion(section = "2.3", id = "d"), @SpecAssertion(section = "2.3", id = "e") }) public void testGroupsDefinedOnMainAnnotationAreInherited() { Validator validator = TestUtil.getValidatorUnderTest(); FrenchAddress address = getFrenchAddressWithoutZipCode(); Set<ConstraintViolation<FrenchAddress>> constraintViolations = validator.validate( address ); assertCorrectNumberOfViolations( constraintViolations, 1 ); ConstraintViolation<FrenchAddress> constraintViolation = constraintViolations.iterator().next(); assertCorrectConstraintTypes( constraintViolations, NotNull.class ); NotNull notNull = ( NotNull ) constraintViolation.getConstraintDescriptor().getAnnotation(); List<Class<?>> groups = Arrays.asList( notNull.groups() ); assertTrue( groups.size() == 2, "There should be two groups" ); assertTrue( groups.contains( Default.class ), "The default group should be in the list." ); assertTrue( groups.contains( FrenchAddress.FullAddressCheck.class ), "The FrenchAddress.FullAddressCheck group should be inherited." ); }
if (notNull != null && isEbeanValidationGroups(notNull.groups())) { prop.setNullable(false);
if (notNull != null && isEbeanValidationGroups(notNull.groups())) {
if (notNull != null && isEbeanValidationGroups(notNull.groups())) { prop.setNullable(false);
if (notNull != null && isEbeanValidationGroups(notNull.groups())) { prop.setNullable(false);
if (notNull != null && isEbeanValidationGroups(notNull.groups())) {
if (notNull != null && isEbeanValidationGroups(notNull.groups())) {