Search in sources :

Example 11 with MethodDescriptor

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

the class MethodDescriptorTest method testIsReturnValueConstrainedForCascadedMethod.

@Test
public void testIsReturnValueConstrainedForCascadedMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "foo");
    assertThat(methodDescriptor.hasConstrainedReturnValue()).isTrue();
}
Also used : MethodDescriptor(jakarta.validation.metadata.MethodDescriptor) ValidatorUtil.getMethodDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodDescriptor) Test(org.testng.annotations.Test)

Example 12 with MethodDescriptor

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

the class MethodDescriptorTest method testGetReturnValueDescriptorForVoidMethod.

@Test
public void testGetReturnValueDescriptorForVoidMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "saveCustomer", Customer.class);
    assertThat(methodDescriptor.getReturnValueDescriptor()).isNotNull();
}
Also used : MethodDescriptor(jakarta.validation.metadata.MethodDescriptor) ValidatorUtil.getMethodDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodDescriptor) Test(org.testng.annotations.Test)

Example 13 with MethodDescriptor

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

the class MethodDescriptorTest method testGetParameterConstraintsForParameterlessMethod.

@Test
public void testGetParameterConstraintsForParameterlessMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "baz");
    List<ParameterDescriptor> parameterConstraints = methodDescriptor.getParameterDescriptors();
    assertNotNull(parameterConstraints);
    assertEquals(parameterConstraints.size(), 0);
}
Also used : ParameterDescriptor(jakarta.validation.metadata.ParameterDescriptor) MethodDescriptor(jakarta.validation.metadata.MethodDescriptor) ValidatorUtil.getMethodDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodDescriptor) Test(org.testng.annotations.Test)

Example 14 with MethodDescriptor

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

the class MethodDescriptorTest method testAreParametersConstrainedForParameterCascadedMethod.

@Test
public void testAreParametersConstrainedForParameterCascadedMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "saveCustomer", Customer.class);
    assertThat(methodDescriptor.hasConstrainedParameters()).isTrue();
}
Also used : MethodDescriptor(jakarta.validation.metadata.MethodDescriptor) ValidatorUtil.getMethodDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getMethodDescriptor) Test(org.testng.annotations.Test)

Example 15 with MethodDescriptor

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

the class BeanDescriptorTest method testGetConstraintsForMethod.

@Test
public void testGetConstraintsForMethod() throws Exception {
    BeanDescriptor descriptor = getBeanDescriptor(CustomerRepository.class);
    MethodDescriptor methodDescriptor = descriptor.getConstraintsForMethod("foo");
    assertNotNull(methodDescriptor);
}
Also used : ValidatorUtil.getBeanDescriptor(org.hibernate.validator.testutils.ValidatorUtil.getBeanDescriptor) BeanDescriptor(jakarta.validation.metadata.BeanDescriptor) MethodDescriptor(jakarta.validation.metadata.MethodDescriptor) Test(org.testng.annotations.Test)

Aggregations

MethodDescriptor (jakarta.validation.metadata.MethodDescriptor)93 Test (org.testng.annotations.Test)86 AbstractTCKTest (org.hibernate.beanvalidation.tck.tests.AbstractTCKTest)49 SpecAssertion (org.jboss.test.audit.annotations.SpecAssertion)44 BeanDescriptor (jakarta.validation.metadata.BeanDescriptor)19 ValidatorUtil.getMethodDescriptor (org.hibernate.validator.testutils.ValidatorUtil.getMethodDescriptor)18 ParameterDescriptor (jakarta.validation.metadata.ParameterDescriptor)13 CrossParameterDescriptor (jakarta.validation.metadata.CrossParameterDescriptor)12 ReturnValueDescriptor (jakarta.validation.metadata.ReturnValueDescriptor)11 ConstraintMapping (org.hibernate.validator.cfg.ConstraintMapping)8 ValidatorUtil.getBeanDescriptor (org.hibernate.validator.testutils.ValidatorUtil.getBeanDescriptor)7 ConstraintDescriptor (jakarta.validation.metadata.ConstraintDescriptor)5 ConstructorDescriptor (jakarta.validation.metadata.ConstructorDescriptor)4 SpecAssertions (org.jboss.test.audit.annotations.SpecAssertions)4 Validator (jakarta.validation.Validator)3 TestUtil.getMethodDescriptor (org.hibernate.beanvalidation.tck.util.TestUtil.getMethodDescriptor)3 TestForIssue (org.hibernate.validator.testutil.TestForIssue)3 Test (org.junit.Test)3 ConstraintValidator (jakarta.validation.ConstraintValidator)2 ValidatorFactory (jakarta.validation.ValidatorFactory)2