Class JsonContentAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<JsonContentAssert,CharSequence>
org.springframework.boot.test.json.JsonContentAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<JsonContentAssert,
,CharSequence> org.assertj.core.api.Descriptable<JsonContentAssert>
,org.assertj.core.api.ExtensionPoints<JsonContentAssert,
CharSequence>
public class JsonContentAssert
extends org.assertj.core.api.AbstractAssert<JsonContentAssert,CharSequence>
AssertJ
Assert
for JsonContent
.- Since:
- 1.4.0
- Author:
- Phillip Webb, Andy Wilkinson, Diego Berrueta, Camille Vienot
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
ConstructorDescriptionJsonContentAssert
(Class<?> resourceLoadClass, CharSequence json) Create a newJsonContentAssert
instance that will load resources as UTF-8.JsonContentAssert
(Class<?> resourceLoadClass, Charset charset, CharSequence json) Create a newJsonContentAssert
instance that will load resources in the givencharset
. -
Method Summary
Modifier and TypeMethodDescriptiondoesNotHaveEmptyJsonPathValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path does not produce anempty
result.doesNotHaveJsonPath
(CharSequence expression, Object... args) Verify that the JSON path is not present, even if it has anull
value.doesNotHaveJsonPathValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces no result.<E> org.assertj.core.api.ListAssert<E>
extractingJsonPathArrayValue
(CharSequence expression, Object... args) Extract the array value at the given JSON path for further object assertions.org.assertj.core.api.AbstractBooleanAssert<?>
extractingJsonPathBooleanValue
(CharSequence expression, Object... args) Extract the boolean value at the given JSON path for further object assertions.<K,
V> org.assertj.core.api.MapAssert<K, V> extractingJsonPathMapValue
(CharSequence expression, Object... args) Extract the map value at the given JSON path for further object assertions.org.assertj.core.api.AbstractObjectAssert<?,
Number> extractingJsonPathNumberValue
(CharSequence expression, Object... args) Extract the number value at the given JSON path for further object assertions.org.assertj.core.api.AbstractCharSequenceAssert<?,
String> extractingJsonPathStringValue
(CharSequence expression, Object... args) Extract the string value at the given JSON path for further object assertions.org.assertj.core.api.AbstractObjectAssert<?,
Object> extractingJsonPathValue
(CharSequence expression, Object... args) Extract the value at the given JSON path for further object assertions.hasEmptyJsonPathValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces anempty
result.hasJsonPath
(CharSequence expression, Object... args) Verify that the JSON path is present without checking if it has a value.hasJsonPathArrayValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces a non-null array result.hasJsonPathBooleanValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces a non-null boolean result.hasJsonPathMapValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces a non-null map result.hasJsonPathNumberValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces a non-null number result.hasJsonPathStringValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces a non-null string result.hasJsonPathValue
(CharSequence expression, Object... args) Verify that the actual value at the given JSON path produces a non-null result.Overridden version ofisEqualTo
to perform JSON tests based on the object type.isEqualToJson
(byte[] expected) Verifies that the actual value isleniently
equal to the specified JSON bytes.isEqualToJson
(byte[] expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON bytes.isEqualToJson
(byte[] expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON bytes.isEqualToJson
(File expected) Verifies that the actual value isleniently
equal to the specified JSON file.isEqualToJson
(File expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON file.isEqualToJson
(File expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON file.isEqualToJson
(InputStream expected) Verifies that the actual value isleniently
equal to the specified JSON input stream.isEqualToJson
(InputStream expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON input stream.isEqualToJson
(InputStream expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON input stream.isEqualToJson
(CharSequence expected) Verifies that the actual value isleniently
equal to the specified JSON.isEqualToJson
(CharSequence expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON.isEqualToJson
(CharSequence expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON.isEqualToJson
(String path, Class<?> resourceLoadClass) Verifies that the actual value isleniently
equal to the specified JSON resource.isEqualToJson
(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON resource.isEqualToJson
(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON resource.isEqualToJson
(Resource expected) Verifies that the actual value isleniently
equal to the specified JSON resource.isEqualToJson
(Resource expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON resource.isEqualToJson
(Resource expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON resource.isNotEqualTo
(Object expected) Overridden version ofisNotEqualTo
to perform JSON tests based on the object type.isNotEqualToJson
(byte[] expected) Verifies that the actual value is notleniently
equal to the specified JSON bytes.isNotEqualToJson
(byte[] expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON bytes.isNotEqualToJson
(byte[] expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON bytes.isNotEqualToJson
(File expected) Verifies that the actual value is notleniently
equal to the specified JSON file.isNotEqualToJson
(File expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON file.isNotEqualToJson
(File expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON file.isNotEqualToJson
(InputStream expected) Verifies that the actual value is notleniently
equal to the specified JSON input stream.isNotEqualToJson
(InputStream expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON input stream.isNotEqualToJson
(InputStream expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON input stream.isNotEqualToJson
(CharSequence expected) Verifies that the actual value is notleniently
equal to the specified JSON.isNotEqualToJson
(CharSequence expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON.isNotEqualToJson
(CharSequence expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON.isNotEqualToJson
(String path, Class<?> resourceLoadClass) Verifies that the actual value is notleniently
equal to the specified JSON resource.isNotEqualToJson
(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON resource.isNotEqualToJson
(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON resource.isNotEqualToJson
(Resource expected) Verifies that the actual value is notleniently
equal to the specified JSON resource.isNotEqualToJson
(Resource expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON resource.isNotEqualToJson
(Resource expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON resource.isNotStrictlyEqualToJson
(byte[] expected) Verifies that the actual value is notstrictly
equal to the specified JSON bytes.isNotStrictlyEqualToJson
(File expected) Verifies that the actual value is notstrictly
equal to the specified JSON file.isNotStrictlyEqualToJson
(InputStream expected) Verifies that the actual value is notstrictly
equal to the specified JSON input stream.isNotStrictlyEqualToJson
(CharSequence expected) Verifies that the actual value is notstrictly
equal to the specified JSON.isNotStrictlyEqualToJson
(String path, Class<?> resourceLoadClass) Verifies that the actual value is notstrictly
equal to the specified JSON resource.isNotStrictlyEqualToJson
(Resource expected) Verifies that the actual value is notstrictly
equal to the specified JSON resource.isStrictlyEqualToJson
(byte[] expected) Verifies that the actual value isstrictly
equal to the specified JSON bytes.isStrictlyEqualToJson
(File expected) Verifies that the actual value isstrictly
equal to the specified JSON file.isStrictlyEqualToJson
(InputStream expected) Verifies that the actual value isstrictly
equal to the specified JSON input stream.isStrictlyEqualToJson
(CharSequence expected) Verifies that the actual value isstrictly
equal to the specified JSON.isStrictlyEqualToJson
(String path, Class<?> resourceLoadClass) Verifies that the actual value isstrictly
equal to the specified JSON resource.isStrictlyEqualToJson
(Resource expected) Verifies that the actual value isstrictly
equal to the specified JSON resource.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, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, 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
-
JsonContentAssert
Create a newJsonContentAssert
instance that will load resources as UTF-8.- Parameters:
resourceLoadClass
- the source class used to load resourcesjson
- the actual JSON content
-
JsonContentAssert
Create a newJsonContentAssert
instance that will load resources in the givencharset
.- Parameters:
resourceLoadClass
- the source class used to load resourcescharset
- the charset of the JSON resourcesjson
- the actual JSON content- Since:
- 1.4.1
-
-
Method Details
-
isEqualTo
Overridden version ofisEqualTo
to perform JSON tests based on the object type.- Specified by:
isEqualTo
in interfaceorg.assertj.core.api.Assert<JsonContentAssert,
CharSequence> - Overrides:
isEqualTo
in classorg.assertj.core.api.AbstractAssert<JsonContentAssert,
CharSequence> - See Also:
-
AbstractAssert.isEqualTo(java.lang.Object)
-
isEqualToJson
Verifies that the actual value isleniently
equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
Verifies that the actual value isleniently
equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resource- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
Verifies that the actual value isleniently
equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytes- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
Verifies that the actual value isleniently
equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
Verifies that the actual value isleniently
equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
Verifies that the actual value isleniently
equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isStrictlyEqualToJson
Verifies that the actual value isstrictly
equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isStrictlyEqualToJson
Verifies that the actual value isstrictly
equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resource- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isStrictlyEqualToJson
Verifies that the actual value isstrictly
equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytes- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isStrictlyEqualToJson
Verifies that the actual value isstrictly
equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isStrictlyEqualToJson
Verifies that the actual value isstrictly
equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isStrictlyEqualToJson
Verifies that the actual value isstrictly
equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(CharSequence expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resourcecompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(byte[] expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytescompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(File expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(InputStream expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(Resource expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(CharSequence expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resourcecomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(byte[] expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytescomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(File expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(InputStream expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isEqualToJson
public JsonContentAssert isEqualToJson(Resource expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is not equal to the given one
-
isNotEqualTo
Overridden version ofisNotEqualTo
to perform JSON tests based on the object type.- Specified by:
isNotEqualTo
in interfaceorg.assertj.core.api.Assert<JsonContentAssert,
CharSequence> - Overrides:
isNotEqualTo
in classorg.assertj.core.api.AbstractAssert<JsonContentAssert,
CharSequence> - See Also:
-
AbstractAssert.isEqualTo(java.lang.Object)
-
isNotEqualToJson
Verifies that the actual value is notleniently
equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
Verifies that the actual value is notleniently
equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resource- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
Verifies that the actual value is notleniently
equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytes- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
Verifies that the actual value is notleniently
equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
Verifies that the actual value is notleniently
equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
Verifies that the actual value is notleniently
equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotStrictlyEqualToJson
Verifies that the actual value is notstrictly
equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotStrictlyEqualToJson
Verifies that the actual value is notstrictly
equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resource- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotStrictlyEqualToJson
Verifies that the actual value is notstrictly
equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytes- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotStrictlyEqualToJson
Verifies that the actual value is notstrictly
equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotStrictlyEqualToJson
Verifies that the actual value is notstrictly
equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotStrictlyEqualToJson
Verifies that the actual value is notstrictly
equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSON- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(CharSequence expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resourcecompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(byte[] expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytescompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(File expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(InputStream expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(Resource expected, org.skyscreamer.jsonassert.JSONCompareMode compareMode) Verifies that the actual value is not equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSONcompareMode
- the compare mode used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(CharSequence expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON. Theexpected
value can contain the JSON itself or, if it ends with.json
, the name of a resource to be loaded usingresourceLoadClass
.- Parameters:
expected
- the expected JSON or the name of a resource containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(String path, Class<?> resourceLoadClass, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON resource.- Parameters:
path
- the name of a resource containing the expected JSONresourceLoadClass
- the source class used to load the resourcecomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(byte[] expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON bytes.- Parameters:
expected
- the expected JSON bytescomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(File expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON file.- Parameters:
expected
- a file containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(InputStream expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON input stream.- Parameters:
expected
- an input stream containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
isNotEqualToJson
public JsonContentAssert isNotEqualToJson(Resource expected, org.skyscreamer.jsonassert.comparator.JSONComparator comparator) Verifies that the actual value is not equal to the specified JSON resource.- Parameters:
expected
- a resource containing the expected JSONcomparator
- the comparator used when checking- Returns:
this
assertion object- Throws:
AssertionError
- if the actual JSON value is equal to the given one
-
hasJsonPath
Verify that the JSON path is present without checking if it has a value.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is missing- Since:
- 2.2.0
- See Also:
-
hasJsonPathValue
Verify that the actual value at the given JSON path produces a non-null result. If the JSON path expression is not definite, this method verifies that the value at the given path is not empty.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is missing
-
hasJsonPathStringValue
Verify that the actual value at the given JSON path produces a non-null string result.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is missing or not a string
-
hasJsonPathNumberValue
Verify that the actual value at the given JSON path produces a non-null number result.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is missing or not a number
-
hasJsonPathBooleanValue
Verify that the actual value at the given JSON path produces a non-null boolean result.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is missing or not a boolean
-
hasJsonPathArrayValue
Verify that the actual value at the given JSON path produces a non-null array result.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is missing or not an array
-
hasJsonPathMapValue
Verify that the actual value at the given JSON path produces a non-null map result.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is missing or not a map
-
hasEmptyJsonPathValue
Verify that the actual value at the given JSON path produces anempty
result.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is not empty
-
doesNotHaveJsonPath
Verify that the JSON path is not present, even if it has anull
value.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is not missing- Since:
- 2.2.0
- See Also:
-
doesNotHaveJsonPathValue
Verify that the actual value at the given JSON path produces no result. If the JSON path expression is not definite, this method verifies that the value at the given path is empty.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is not missing
-
doesNotHaveEmptyJsonPathValue
Verify that the actual value at the given JSON path does not produce anempty
result.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
this
assertion object- Throws:
AssertionError
- if the value at the given path is empty
-
extractingJsonPathValue
public org.assertj.core.api.AbstractObjectAssert<?,Object> extractingJsonPathValue(CharSequence expression, Object... args) Extract the value at the given JSON path for further object assertions.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
- a new assertion object whose object under test is the extracted item
- Throws:
AssertionError
- if the path is not valid
-
extractingJsonPathStringValue
public org.assertj.core.api.AbstractCharSequenceAssert<?,String> extractingJsonPathStringValue(CharSequence expression, Object... args) Extract the string value at the given JSON path for further object assertions.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
- a new assertion object whose object under test is the extracted item
- Throws:
AssertionError
- if the path is not valid or does not result in a string
-
extractingJsonPathNumberValue
public org.assertj.core.api.AbstractObjectAssert<?,Number> extractingJsonPathNumberValue(CharSequence expression, Object... args) Extract the number value at the given JSON path for further object assertions.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
- a new assertion object whose object under test is the extracted item
- Throws:
AssertionError
- if the path is not valid or does not result in a number
-
extractingJsonPathBooleanValue
public org.assertj.core.api.AbstractBooleanAssert<?> extractingJsonPathBooleanValue(CharSequence expression, Object... args) Extract the boolean value at the given JSON path for further object assertions.- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
- a new assertion object whose object under test is the extracted item
- Throws:
AssertionError
- if the path is not valid or does not result in a boolean
-
extractingJsonPathArrayValue
public <E> org.assertj.core.api.ListAssert<E> extractingJsonPathArrayValue(CharSequence expression, Object... args) Extract the array value at the given JSON path for further object assertions.- Type Parameters:
E
- element type- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
- a new assertion object whose object under test is the extracted item
- Throws:
AssertionError
- if the path is not valid or does not result in an array
-
extractingJsonPathMapValue
public <K,V> org.assertj.core.api.MapAssert<K,V> extractingJsonPathMapValue(CharSequence expression, Object... args) Extract the map value at the given JSON path for further object assertions.- Type Parameters:
K
- key typeV
- value type- Parameters:
expression
- theJsonPath
expressionargs
- arguments to parameterize theJsonPath
expression with, using formatting specifiers defined inString.format(String, Object...)
- Returns:
- a new assertion object whose object under test is the extracted item
- Throws:
AssertionError
- if the path is not valid or does not result in a map
-