Search in sources :

Example 1 with ReturnValueDescriptor

use of jakarta.validation.metadata.ReturnValueDescriptor in project hibernate-validator by hibernate.

the class ReturnValueDescriptorTest method testIsCascaded.

@Test
public void testIsCascaded() {
    ReturnValueDescriptor elementDescriptor = getMethodReturnValueDescriptor(CustomerRepository.class, "foo");
    assertTrue(elementDescriptor.isCascaded());
}
Also used : ReturnValueDescriptor(jakarta.validation.metadata.ReturnValueDescriptor) ValidatorUtil.getMethodReturnValueDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodReturnValueDescriptor) Test(org.testng.annotations.Test)

Example 2 with ReturnValueDescriptor

use of jakarta.validation.metadata.ReturnValueDescriptor in project hibernate-validator by hibernate.

the class ReturnValueDescriptorTest method testHasConstraintsConsidersConstraintsFromSuperType.

@Test
public void testHasConstraintsConsidersConstraintsFromSuperType() {
    ReturnValueDescriptor constrainedReturnDescriptor = getMethodReturnValueDescriptor(CustomerRepositoryExt.class, "bar");
    assertTrue(constrainedReturnDescriptor.hasConstraints());
}
Also used : ReturnValueDescriptor(jakarta.validation.metadata.ReturnValueDescriptor) ValidatorUtil.getMethodReturnValueDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodReturnValueDescriptor) Test(org.testng.annotations.Test)

Example 3 with ReturnValueDescriptor

use of jakarta.validation.metadata.ReturnValueDescriptor in project hibernate-validator by hibernate.

the class ReturnValueDescriptorTest method testFindConstraintMatchingGroups.

@Test
public void testFindConstraintMatchingGroups() {
    ReturnValueDescriptor returnValueDescriptor = getMethodReturnValueDescriptor(CustomerRepositoryExt.class, "baz");
    assertConstraintTypes(returnValueDescriptor.findConstraints().unorderedAndMatchingGroups(ValidationGroup.class).getConstraintDescriptors(), NotNull.class);
}
Also used : ReturnValueDescriptor(jakarta.validation.metadata.ReturnValueDescriptor) ValidatorUtil.getMethodReturnValueDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodReturnValueDescriptor) Test(org.testng.annotations.Test)

Example 4 with ReturnValueDescriptor

use of jakarta.validation.metadata.ReturnValueDescriptor in project hibernate-validator by hibernate.

the class ReturnValueDescriptorTest method testIsNotCascaded.

@Test
public void testIsNotCascaded() {
    ReturnValueDescriptor elementDescriptor = getMethodReturnValueDescriptor(CustomerRepository.class, "bar");
    assertFalse(elementDescriptor.isCascaded());
}
Also used : ReturnValueDescriptor(jakarta.validation.metadata.ReturnValueDescriptor) ValidatorUtil.getMethodReturnValueDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodReturnValueDescriptor) Test(org.testng.annotations.Test)

Example 5 with ReturnValueDescriptor

use of jakarta.validation.metadata.ReturnValueDescriptor in project hibernate-validator by hibernate.

the class ConstructorDescriptorTest method testGetReturnValueDescriptor.

@Test
public void testGetReturnValueDescriptor() {
    ConstructorDescriptor constructorDescriptor = getConstructorDescriptor(CustomerRepositoryExt.class, String.class);
    ReturnValueDescriptor returnValueDescriptor = constructorDescriptor.getReturnValueDescriptor();
    assertThat(returnValueDescriptor).isNotNull();
    assertThat(returnValueDescriptor.getElementClass()).isEqualTo(CustomerRepositoryExt.class);
    assertThat(returnValueDescriptor.hasConstraints()).isTrue();
    assertThat(returnValueDescriptor.isCascaded()).isTrue();
    Set<ConstraintDescriptor<?>> constraintDescriptors = returnValueDescriptor.getConstraintDescriptors();
    assertThat(constraintDescriptors).hasSize(1);
    ConstraintDescriptor<?> descriptor = constraintDescriptors.iterator().next();
    assertThat(descriptor.getAnnotation().annotationType()).isEqualTo(ValidB2BRepository.class);
}
Also used : ReturnValueDescriptor(jakarta.validation.metadata.ReturnValueDescriptor) ConstraintDescriptor(jakarta.validation.metadata.ConstraintDescriptor) ConstructorDescriptor(jakarta.validation.metadata.ConstructorDescriptor) ValidatorUtil.getConstructorDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getConstructorDescriptor) Test(org.testng.annotations.Test)

Aggregations

ReturnValueDescriptor (jakarta.validation.metadata.ReturnValueDescriptor)14 Test (org.testng.annotations.Test)11 ValidatorUtil.getMethodReturnValueDescriptor (org.hibernate.validator.testutils.ValidatorUtil.getMethodReturnValueDescriptor)10 BeanDescriptor (jakarta.validation.metadata.BeanDescriptor)3 ConstraintDescriptor (jakarta.validation.metadata.ConstraintDescriptor)3 ConstructorDescriptor (jakarta.validation.metadata.ConstructorDescriptor)3 CrossParameterDescriptor (jakarta.validation.metadata.CrossParameterDescriptor)3 MethodDescriptor (jakarta.validation.metadata.MethodDescriptor)3 Test (org.junit.Test)3 ParameterDescriptor (jakarta.validation.metadata.ParameterDescriptor)2 GroupConversionDescriptor (jakarta.validation.metadata.GroupConversionDescriptor)1 Date (java.util.Date)1 TestForIssue (org.hibernate.validator.testutil.TestForIssue)1 ValidatorUtil.getConstructorDescriptor (org.hibernate.validator.testutils.ValidatorUtil.getConstructorDescriptor)1