| Constructor and Description |
|---|
JsonPathExpectationsHelper(String expression,
Object... args)
Construct a new
JsonPathExpectationsHelper. |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
assertValue(String content,
org.hamcrest.Matcher<T> matcher)
Evaluate the JSON path expression against the supplied
content
and assert the resulting value with the given Matcher. |
void |
assertValue(String content,
Object expectedValue)
Evaluate the JSON path expression against the supplied
content
and assert that the result is equal to the expected value. |
void |
assertValueIsArray(String content)
Evaluate the JSON path expression against the supplied
content
and assert that the resulting value is an array. |
void |
assertValueIsBoolean(String content)
Evaluate the JSON path expression against the supplied
content
and assert that the resulting value is a Boolean. |
void |
assertValueIsEmpty(String content)
Evaluate the JSON path expression against the supplied
content
and assert that an empty value exists at the given path. |
void |
assertValueIsMap(String content)
Evaluate the JSON path expression against the supplied
content
and assert that the resulting value is a Map. |
void |
assertValueIsNotEmpty(String content)
Evaluate the JSON path expression against the supplied
content
and assert that a non-empty value exists at the given path. |
void |
assertValueIsNumber(String content)
Evaluate the JSON path expression against the supplied
content
and assert that the resulting value is a Number. |
void |
assertValueIsString(String content)
Evaluate the JSON path expression against the supplied
content
and assert that the resulting value is a String. |
void |
doesNotExist(String content)
Evaluate the JSON path expression against the supplied
content
and assert that a value does not exist at the given path. |
void |
exists(String content)
Evaluate the JSON path expression against the supplied
content
and assert that a non-null value exists at the given path. |
public JsonPathExpectationsHelper(String expression, Object... args)
JsonPathExpectationsHelper.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> void assertValue(String content, org.hamcrest.Matcher<T> matcher) throws ParseException
content
and assert the resulting value with the given Matcher.content - the JSON contentmatcher - the matcher with which to assert the resultParseExceptionpublic void assertValue(String content, Object expectedValue) throws ParseException
content
and assert that the result is equal to the expected value.content - the JSON contentexpectedValue - the expected valueParseExceptionpublic void assertValueIsString(String content) throws ParseException
content
and assert that the resulting value is a String.content - the JSON contentParseExceptionpublic void assertValueIsBoolean(String content) throws ParseException
content
and assert that the resulting value is a Boolean.content - the JSON contentParseExceptionpublic void assertValueIsNumber(String content) throws ParseException
content
and assert that the resulting value is a Number.content - the JSON contentParseExceptionpublic void assertValueIsArray(String content) throws ParseException
content
and assert that the resulting value is an array.content - the JSON contentParseExceptionpublic void assertValueIsMap(String content) throws ParseException
content
and assert that the resulting value is a Map.content - the JSON contentParseExceptionpublic void exists(String content) throws ParseException
content
and assert that a non-null value exists at the given path.
If the JSON path expression is not definite, this method asserts that the value at the given path is not empty.
content - the JSON contentParseExceptionpublic void doesNotExist(String content) throws ParseException
content
and assert that a value does not exist at the given path.
If the JSON path expression is not definite, this method asserts that the value at the given path is empty.
content - the JSON contentParseExceptionpublic void assertValueIsEmpty(String content) throws ParseException
content
and assert that an empty value exists at the given path.
For the semantics of empty, consult the Javadoc for
ObjectUtils.isEmpty(Object).
content - the JSON contentParseExceptionpublic void assertValueIsNotEmpty(String content) throws ParseException
content
and assert that a non-empty value exists at the given path.
For the semantics of empty, consult the Javadoc for
ObjectUtils.isEmpty(Object).
content - the JSON contentParseException