Package org.springframework.test.json
Class JsonPathAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<JsonPathAssert,CharSequence>
org.springframework.test.json.JsonPathAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<JsonPathAssert,
,CharSequence> org.assertj.core.api.Descriptable<JsonPathAssert>
,org.assertj.core.api.ExtensionPoints<JsonPathAssert,
CharSequence>
public class JsonPathAssert
extends org.assertj.core.api.AbstractAssert<JsonPathAssert,CharSequence>
AssertJ
assertions
that can be applied
to a CharSequence
representation of a JSON document using
JSON path.- Since:
- 6.2
- Author:
- Stephane Nicoll
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
ConstructorDescriptionJsonPathAssert
(CharSequence json, GenericHttpMessageConverter<Object> jsonMessageConverter) -
Method Summary
Modifier and TypeMethodDescriptiondoesNotHavePath
(String path) Verify that the given JSONpath
does not match.extractingPath
(String path) Verify that the given JSONpath
is present, and extract the JSON value for further assertions.Verify that the given JSONpath
matches.hasPathSatisfying
(String path, Consumer<org.assertj.core.api.AssertProvider<JsonPathValueAssert>> valueRequirements) Verify that the given JSONpath
is present with a JSON value satisfying the givenvalueRequirements
.Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs, describedAs
-
Constructor Details
-
JsonPathAssert
public JsonPathAssert(CharSequence json, @Nullable GenericHttpMessageConverter<Object> jsonMessageConverter)
-
-
Method Details
-
extractingPath
Verify that the given JSONpath
is present, and extract the JSON value for further assertions.- Parameters:
path
- theJsonPath
expression- See Also:
-
hasPathSatisfying
public JsonPathAssert hasPathSatisfying(String path, Consumer<org.assertj.core.api.AssertProvider<JsonPathValueAssert>> valueRequirements) Verify that the given JSONpath
is present with a JSON value satisfying the givenvalueRequirements
.- Parameters:
path
- theJsonPath
expressionvalueRequirements
- aConsumer
of the assertion object
-
hasPath
Verify that the given JSONpath
matches. For paths with an operator, this validates that the path expression is valid, but does not validate that it yield any results.- Parameters:
path
- theJsonPath
expression
-
doesNotHavePath
Verify that the given JSONpath
does not match.- Parameters:
path
- theJsonPath
expression
-