use of jakarta.validation.metadata.CrossParameterDescriptor in project hibernate-validator by hibernate.
the class IgnoreCrossParameterConstraintTest method testCrossParameterConstraintsAreIgnored.
@Test
@TestForIssue(jiraKey = "HV-734")
public void testCrossParameterConstraintsAreIgnored() {
Validator validator = getXmlConfiguredValidator("ignore-annotations-for-cross-parameter-constraints.xml");
BeanDescriptor beanDescriptor = validator.getConstraintsForClass(this.getClass());
// check that the test constructor has no cross parameter constraint
ConstructorDescriptor constructorDescriptor = beanDescriptor.getConstraintsForConstructor(String.class, String.class);
CrossParameterDescriptor crossParameterDescriptor = constructorDescriptor.getCrossParameterDescriptor();
assertFalse(crossParameterDescriptor.hasConstraints(), "There should be no cross parameter constraints.");
// check that the test method has no cross parameter constraint
MethodDescriptor methodDescriptor = beanDescriptor.getConstraintsForMethod("snafu", String.class, String.class);
crossParameterDescriptor = methodDescriptor.getCrossParameterDescriptor();
assertFalse(crossParameterDescriptor.hasConstraints(), "There should be no cross parameter constraints.");
}
use of jakarta.validation.metadata.CrossParameterDescriptor in project hibernate-validator by hibernate.
the class CrossParameterDescriptorTest method testHasConstraintsForConstructorDoesNotConsiderConstraintsFromSuperType.
@Test
public void testHasConstraintsForConstructorDoesNotConsiderConstraintsFromSuperType() {
CrossParameterDescriptor descriptor = getConstructorDescriptor(CustomerRepositoryExt.class, LocalDate.class, LocalDate.class).getCrossParameterDescriptor();
assertFalse(descriptor.hasConstraints(), "Constructor has no cross-parameter.");
}
use of jakarta.validation.metadata.CrossParameterDescriptor in project hibernate-validator by hibernate.
the class CrossParameterDescriptorTest method testGetConstraintDescriptorsForConstructorDoesNotConsiderConstraintsFromSuperType.
@Test
public void testGetConstraintDescriptorsForConstructorDoesNotConsiderConstraintsFromSuperType() {
CrossParameterDescriptor descriptor = getConstructorDescriptor(CustomerRepositoryExt.class, LocalDate.class, LocalDate.class).getCrossParameterDescriptor();
assertTrue(descriptor.getConstraintDescriptors().isEmpty());
}
use of jakarta.validation.metadata.CrossParameterDescriptor in project hibernate-validator by hibernate.
the class CrossParameterDescriptorTest method testHasConstraintsForConstructor.
@Test
public void testHasConstraintsForConstructor() {
CrossParameterDescriptor descriptor = getConstructorDescriptor(CustomerRepository.class).getCrossParameterDescriptor();
assertFalse(descriptor.hasConstraints(), "Constructor has no cross-parameter constraints.");
descriptor = getConstructorDescriptor(CustomerRepository.class, LocalDate.class, LocalDate.class).getCrossParameterDescriptor();
assertTrue(descriptor.hasConstraints(), "Constructor has one cross-parameter constraint.");
}
use of jakarta.validation.metadata.CrossParameterDescriptor in project hibernate-validator by hibernate.
the class CrossParameterDescriptorTest method testGetConstraintDescriptorsForMethodConsidersConstraintsFromSuperType.
@Test
public void testGetConstraintDescriptorsForMethodConsidersConstraintsFromSuperType() {
CrossParameterDescriptor descriptor = getMethodDescriptor(CustomerRepositoryExt.class, "methodWithCrossParameterConstraint", LocalDate.class, LocalDate.class).getCrossParameterDescriptor();
assertConstraintTypes(descriptor.getConstraintDescriptors(), ConsistentDateParameters.class);
}
Aggregations