Class TestUtils


  • public class TestUtils
    extends Object
    Description:
    • Constructor Detail

      • TestUtils

        public TestUtils()
    • Method Detail

      • getViolation

        public static <T> jakarta.validation.ConstraintViolation<T> getViolation​(Set<jakarta.validation.ConstraintViolation<T>> violations,
                                                                                 String propertyPath)
        Parameters:
        violations -
        propertyPath - - string format of a propertyPath
        Returns:
        the constraintViolation with the propertyPath's string representation given
      • countViolations

        public static <T> int countViolations​(Set<jakarta.validation.ConstraintViolation<T>> violations,
                                              String propertyPath)
        Parameters:
        violations -
        propertyPath -
        Returns:
        count of violations
      • getViolationWithMessage

        public static <T> jakarta.validation.ConstraintViolation<T> getViolationWithMessage​(Set<jakarta.validation.ConstraintViolation<T>> violations,
                                                                                            String message)
        Type Parameters:
        T -
        Parameters:
        violations -
        message -
        Returns:
        the constraint violation with the specified message found, if any
      • failOnModifiable

        public static void failOnModifiable​(Collection<?> collection,
                                            String description)
        assume set addition either does nothing, returning false per collection contract, or throws an Exception; in either case size should remain unchanged
        Parameters:
        collection -
      • assertConstraintTypesFound

        public static void assertConstraintTypesFound​(jakarta.validation.metadata.ElementDescriptor.ConstraintFinder constraintFinder,
                                                      Class<? extends Annotation>... types)
        Assert that the specified ConstraintFinder provides constraints of each of the specified types.
        Parameters:
        constraintFinder -
        types -