public final class ConstraintViolationAssert extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ConstraintViolationAssert.ConstraintViolationSetAssert |
static class |
ConstraintViolationAssert.PathExpectation
A property path expected to be returned by a given
ConstraintViolation. |
static class |
ConstraintViolationAssert.ViolationExpectation |
| Modifier and Type | Field and Description |
|---|---|
static String |
BEAN_NODE_NAME
Expected name for return value nodes.
|
static String |
CROSS_PARAMETER_NODE_NAME
Expected name for cross-parameter nodes.
|
static String |
RETURN_VALUE_NODE_NAME
Expected name for cross-parameter nodes.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
assertConstraintViolation(javax.validation.ConstraintViolation<?> violation,
Class<?> rootBeanClass)
Asserts that the error message and the root bean class of the given violation are equal to the expected message
and root bean class.
|
static void |
assertConstraintViolation(javax.validation.ConstraintViolation<?> violation,
Class<?> rootBeanClass,
Object invalidValue)
Asserts that the error message, root bean class and invalid value of the given violation are equal to the
expected message, root bean class and invalid value.
|
static void |
assertConstraintViolation(javax.validation.ConstraintViolation<?> violation,
Class<?> rootBeanClass,
Object invalidValue,
ConstraintViolationAssert.PathExpectation propertyPath)
Asserts that the error message, root bean class, invalid value and property path of the given violation are equal
to the expected message, root bean class, invalid value and propertyPath.
|
static void |
assertCorrectConstraintTypes(Set<? extends javax.validation.ConstraintViolation<?>> violations,
Class<?>... expectedConstraintTypes)
Asserts that the violated constraint type in the violation list matches exactly the expected constraint types
list.
|
static void |
assertCorrectConstraintViolationMessages(javax.validation.ConstraintViolationException e,
String... expectedMessages) |
static void |
assertCorrectConstraintViolationMessages(Set<? extends javax.validation.ConstraintViolation<?>> violations,
String... expectedMessages)
Asserts that the messages in the violation list matches exactly the expected messages list.
|
static void |
assertNumberOfViolations(Set<? extends javax.validation.ConstraintViolation<?>> violations,
int numberOfViolations)
Asserts that the given violation list has the expected number of violations.
|
static ConstraintViolationAssert.ConstraintViolationSetAssert |
assertThat(Set<? extends javax.validation.ConstraintViolation<?>> actualViolations) |
static boolean |
pathsAreEqual(ConstraintViolationAssert.PathExpectation p1,
ConstraintViolationAssert.PathExpectation p2)
Checks that two property paths are equal.
|
static boolean |
pathsAreEqual(javax.validation.Path p1,
ConstraintViolationAssert.PathExpectation p2)
Checks that two property paths are equal.
|
static boolean |
pathsAreEqual(javax.validation.Path p1,
javax.validation.Path p2)
Checks that two property paths are equal.
|
static ConstraintViolationAssert.PathExpectation |
pathWith() |
static ConstraintViolationAssert.ViolationExpectation |
violationOf(Class<? extends Annotation> constraintType) |
public static final String BEAN_NODE_NAME
public static final String CROSS_PARAMETER_NODE_NAME
public static final String RETURN_VALUE_NODE_NAME
public static void assertCorrectConstraintViolationMessages(Set<? extends javax.validation.ConstraintViolation<?>> violations, String... expectedMessages)
violations - The violation list to verify.expectedMessages - The expected constraint violation messages.public static void assertCorrectConstraintViolationMessages(javax.validation.ConstraintViolationException e,
String... expectedMessages)
public static void assertCorrectConstraintTypes(Set<? extends javax.validation.ConstraintViolation<?>> violations, Class<?>... expectedConstraintTypes)
violations - The violation list to verify.expectedConstraintTypes - The expected constraint types.public static ConstraintViolationAssert.ConstraintViolationSetAssert assertThat(Set<? extends javax.validation.ConstraintViolation<?>> actualViolations)
public static void assertConstraintViolation(javax.validation.ConstraintViolation<?> violation,
Class<?> rootBeanClass,
Object invalidValue,
ConstraintViolationAssert.PathExpectation propertyPath)
violation - The violation to verify.rootBeanClass - The expected root bean class.invalidValue - The expected invalid value.propertyPath - The expected property path.public static void assertConstraintViolation(javax.validation.ConstraintViolation<?> violation,
Class<?> rootBeanClass,
Object invalidValue)
violation - The violation to verify.rootBeanClass - The expected root bean class.invalidValue - The expected invalid value.public static void assertConstraintViolation(javax.validation.ConstraintViolation<?> violation,
Class<?> rootBeanClass)
violation - The violation to verify.rootBeanClass - The expected root bean class.public static void assertNumberOfViolations(Set<? extends javax.validation.ConstraintViolation<?>> violations, int numberOfViolations)
violations - The violation list to verify.numberOfViolations - The expected number of violation.public static boolean pathsAreEqual(javax.validation.Path p1,
javax.validation.Path p2)
p1 - The first property path.p2 - The second property path.true if the given paths are equal, false otherwise.public static boolean pathsAreEqual(javax.validation.Path p1,
ConstraintViolationAssert.PathExpectation p2)
p1 - The first property path.p2 - The second property path.true if the given paths are equal, false otherwise.public static boolean pathsAreEqual(ConstraintViolationAssert.PathExpectation p1, ConstraintViolationAssert.PathExpectation p2)
p1 - The first property path.p2 - The second property path.true if the given paths are equal, false otherwise.public static ConstraintViolationAssert.PathExpectation pathWith()
public static ConstraintViolationAssert.ViolationExpectation violationOf(Class<? extends Annotation> constraintType)
Copyright © 2008–2017. All rights reserved.