Package org.apache.bval.jsr.util
Class TestUtils
- java.lang.Object
-
- org.apache.bval.jsr.util.TestUtils
-
public class TestUtils extends Object
Description:
-
-
Constructor Summary
Constructors Constructor Description TestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static <T> int
countViolations(Set<jakarta.validation.ConstraintViolation<T>> violations, String propertyPath)
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 unchangedstatic <T> jakarta.validation.ConstraintViolation<T>
getViolation(Set<jakarta.validation.ConstraintViolation<T>> violations, String propertyPath)
static <T> jakarta.validation.ConstraintViolation<T>
getViolationWithMessage(Set<jakarta.validation.ConstraintViolation<T>> violations, String message)
-
-
-
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
-
-
-