public class JsonPathResultMatchers extends Object
An instance of this class is typically accessed via
MockMvcResultMatchers.jsonPath(String, Matcher)
or
MockMvcResultMatchers.jsonPath(String, Object...)
.
Modifier | Constructor and Description |
---|---|
protected |
JsonPathResultMatchers(String expression,
Object... args)
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
ResultMatcher |
doesNotExist()
Evaluate the JSON path expression against the response content and
assert that a value does not exist at the given path.
|
ResultMatcher |
exists()
Evaluate the JSON path expression against the response content and
assert that a non-null value exists at the given path.
|
ResultMatcher |
isArray()
Evaluate the JSON path expression against the response content and
assert that the result is an array.
|
<T> ResultMatcher |
value(org.hamcrest.Matcher<T> matcher)
Evaluate the JSON path expression against the response content and
assert the resulting value with the given Hamcrest
Matcher . |
ResultMatcher |
value(Object expectedValue)
Evaluate the JSON path expression against the response content and
assert that the result is equal to the supplied value.
|
protected JsonPathResultMatchers(String expression, Object... args)
Use MockMvcResultMatchers.jsonPath(String, Object...)
or
MockMvcResultMatchers.jsonPath(String, Matcher)
.
expression
- the JsonPath
expression; never null
or emptyargs
- arguments to parameterize the JsonPath
expression with,
using formatting specifiers defined in String.format(String, Object...)
public <T> ResultMatcher value(org.hamcrest.Matcher<T> matcher)
Matcher
.public ResultMatcher value(Object expectedValue)
public ResultMatcher exists()
If the JSON path expression is not definite, this method asserts that the value at the given path is not empty.
public ResultMatcher doesNotExist()
If the JSON path expression is not definite, this method asserts that the value at the given path is empty.
public ResultMatcher isArray()