public class ModelResultMatchers extends 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(String name,
Matcher<T> matcher)
Assert a model attribute value with the given Hamcrest
Matcher . |
ResultMatcher |
attribute(String name,
Object value)
Assert a model attribute value.
|
ResultMatcher |
attributeDoesNotExist(String... names)
Assert the given model attributes do not exist.
|
ResultMatcher |
attributeErrorCount(String name,
int expectedCount)
Assert the given model attribute(s) have errors.
|
ResultMatcher |
attributeExists(String... names)
Assert the given model attributes exist.
|
ResultMatcher |
attributeHasErrors(String... names)
Assert the given model attribute(s) have errors.
|
ResultMatcher |
attributeHasFieldErrorCode(String name,
String fieldName,
Matcher<? super String> matcher)
Assert a field error code for a model attribute using a
Matcher . |
ResultMatcher |
attributeHasFieldErrorCode(String name,
String fieldName,
String error)
Assert a field error code for a model attribute using exact String match.
|
ResultMatcher |
attributeHasFieldErrors(String name,
String... fieldNames)
Assert the given model attribute field(s) have errors.
|
ResultMatcher |
attributeHasNoErrors(String... names)
Assert the given model attribute(s) do not have errors.
|
ResultMatcher |
errorCount(int expectedCount)
Assert the total number of errors in the model.
|
ResultMatcher |
hasErrors()
Assert the model has errors.
|
ResultMatcher |
hasNoErrors()
Assert the model has no errors.
|
ResultMatcher |
size(int size)
Assert the number of model attributes.
|
protected ModelResultMatchers()
MockMvcResultMatchers.model()
.public <T> ResultMatcher attribute(String name, Matcher<T> matcher)
Matcher
.public ResultMatcher attribute(String name, Object value)
public ResultMatcher attributeExists(String... names)
public ResultMatcher attributeDoesNotExist(String... names)
public ResultMatcher attributeErrorCount(String name, int expectedCount)
public ResultMatcher attributeHasErrors(String... names)
public ResultMatcher attributeHasNoErrors(String... names)
public ResultMatcher attributeHasFieldErrors(String name, String... fieldNames)
public ResultMatcher attributeHasFieldErrorCode(String name, String fieldName, String error)
public ResultMatcher attributeHasFieldErrorCode(String name, String fieldName, Matcher<? super String> matcher)
Matcher
.public ResultMatcher errorCount(int expectedCount)
public ResultMatcher hasErrors()
public ResultMatcher hasNoErrors()
public ResultMatcher size(int size)