use of jakarta.validation.metadata.MethodDescriptor in project hibernate-validator by hibernate.
the class ConstraintMappingWithAnnotationProcessingOptionsTest method testIgnoreAnnotationsOnMethod.
@Test
public void testIgnoreAnnotationsOnMethod() {
ConstraintMapping mapping = config.createConstraintMapping();
mapping.type(Doer.class).method("doSomething", String.class).ignoreAnnotations(true);
config.addMapping(mapping);
MethodDescriptor descriptor = config.buildValidatorFactory().getValidator().getConstraintsForClass(Doer.class).getConstraintsForMethod("doSomething", String.class);
assertNull(descriptor);
}
use of jakarta.validation.metadata.MethodDescriptor in project hibernate-validator by hibernate.
the class MethodDescriptorTest method testFindConstraintsMatchingGroups.
@Test
public void testFindConstraintsMatchingGroups() {
MethodDescriptor descriptor = getMethodDescriptor(CustomerRepositoryExt.class, "methodWithCrossParameterConstraint", LocalDate.class, LocalDate.class);
assertTrue(descriptor.findConstraints().getConstraintDescriptors().isEmpty());
}
use of jakarta.validation.metadata.MethodDescriptor in project hibernate-validator by hibernate.
the class MethodDescriptorTest method testIsReturnValueConstrainedForConstrainedMethod.
@Test
public void testIsReturnValueConstrainedForConstrainedMethod() {
MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "baz");
assertThat(methodDescriptor.hasConstrainedReturnValue()).isTrue();
}
use of jakarta.validation.metadata.MethodDescriptor in project hibernate-validator by hibernate.
the class MethodDescriptorTest method testGetElementClass.
@Test
public void testGetElementClass() {
// the return type as defined in the base type
MethodDescriptor methodDescriptor = getMethodDescriptor(CustomerRepository.class, "bar");
assertEquals(methodDescriptor.getElementClass(), Customer.class);
// the return type is now the one as defined in the derived type (covariant return type)
methodDescriptor = getMethodDescriptor(CustomerRepositoryExt.class, "bar");
assertEquals(methodDescriptor.getElementClass(), CustomerExtension.class);
}
use of jakarta.validation.metadata.MethodDescriptor in project hibernate-validator by hibernate.
the class MethodDescriptorTest method testGetConstraintDescriptors.
@Test
public void testGetConstraintDescriptors() {
MethodDescriptor descriptor = getMethodDescriptor(CustomerRepository.class, "bar");
assertTrue(descriptor.getConstraintDescriptors().isEmpty());
descriptor = getMethodDescriptor(CustomerRepository.class, "methodWithCrossParameterConstraint", LocalDate.class, LocalDate.class);
assertTrue(descriptor.getConstraintDescriptors().isEmpty());
}
Aggregations