public class ModelResultMatchers
extends java.lang.Object
An instance of this class is typically accessed via
MockMvcResultMatchers.model()
.
Modifier | Constructor and Description |
---|---|
protected |
ModelResultMatchers()
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> ResultMatcher |
attribute(java.lang.String name,
org.hamcrest.Matcher<T> matcher)
Assert a model attribute value with the given Hamcrest
Matcher . |
ResultMatcher |
attribute(java.lang.String name,
java.lang.Object value)
Assert a model attribute value.
|
ResultMatcher |
attributeDoesNotExist(java.lang.String... names)
Assert the given model attributes do not exist.
|
ResultMatcher |
attributeErrorCount(java.lang.String name,
int expectedCount)
Assert the given model attribute(s) have errors.
|
ResultMatcher |
attributeExists(java.lang.String... names)
Assert the given model attributes exist.
|
ResultMatcher |
attributeHasErrors(java.lang.String... names)
Assert the given model attribute(s) have errors.
|
<T> ResultMatcher |
attributeHasFieldErrorCode(java.lang.String name,
java.lang.String fieldName,
org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert a field error code for a model attribute using a
Matcher . |
ResultMatcher |
attributeHasFieldErrorCode(java.lang.String name,
java.lang.String fieldName,
java.lang.String error)
Assert a field error code for a model attribute using exact String match.
|
ResultMatcher |
attributeHasFieldErrors(java.lang.String name,
java.lang.String... fieldNames)
Assert the given model attribute field(s) have errors.
|
ResultMatcher |
attributeHasNoErrors(java.lang.String... names)
Assert the given model attribute(s) do not have errors.
|
<T> ResultMatcher |
errorCount(int expectedCount)
Assert the total number of errors in the model.
|
<T> ResultMatcher |
hasErrors()
Assert the model has errors.
|
<T> ResultMatcher |
hasNoErrors()
Assert the model has no errors.
|
<T> ResultMatcher |
size(int size)
Assert the number of model attributes.
|
protected ModelResultMatchers()
MockMvcResultMatchers.model()
.public <T> ResultMatcher attribute(java.lang.String name, org.hamcrest.Matcher<T> matcher)
Matcher
.public ResultMatcher attribute(java.lang.String name, java.lang.Object value)
public ResultMatcher attributeExists(java.lang.String... names)
public ResultMatcher attributeDoesNotExist(java.lang.String... names)
public ResultMatcher attributeErrorCount(java.lang.String name, int expectedCount)
public ResultMatcher attributeHasErrors(java.lang.String... names)
public ResultMatcher attributeHasNoErrors(java.lang.String... names)
public ResultMatcher attributeHasFieldErrors(java.lang.String name, java.lang.String... fieldNames)
public ResultMatcher attributeHasFieldErrorCode(java.lang.String name, java.lang.String fieldName, java.lang.String error)
public <T> ResultMatcher attributeHasFieldErrorCode(java.lang.String name, java.lang.String fieldName, org.hamcrest.Matcher<? super java.lang.String> matcher)
Matcher
.public <T> ResultMatcher errorCount(int expectedCount)
public <T> ResultMatcher hasErrors()
public <T> ResultMatcher hasNoErrors()
public <T> ResultMatcher size(int size)