Package org.springframework.test.json
Class AbstractJsonValueAssert<SELF extends AbstractJsonValueAssert<SELF>>
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractObjectAssert<SELF,Object>
org.springframework.test.json.AbstractJsonValueAssert<SELF>
- Type Parameters:
SELF
- the type of assertions
- All Implemented Interfaces:
org.assertj.core.api.Assert<SELF,
,Object> org.assertj.core.api.Descriptable<SELF>
,org.assertj.core.api.ExtensionPoints<SELF,
Object>
- Direct Known Subclasses:
JsonPathValueAssert
public abstract class AbstractJsonValueAssert<SELF extends AbstractJsonValueAssert<SELF>>
extends org.assertj.core.api.AbstractObjectAssert<SELF,Object>
Base AssertJ assertions that can be
applied to a JSON value.
In JSON, values must be one of the following data types:
This base class offers direct access for each of those types as well as conversion methods based on an optionalGenericHttpMessageConverter
.- Since:
- 6.2
- Author:
- Stephane Nicoll
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractJsonValueAssert
(Object actual, Class<?> selfType, GenericHttpMessageConverter<Object> httpMessageConverter) -
Method Summary
Modifier and TypeMethodDescriptionorg.assertj.core.api.ObjectArrayAssert<Object>
asArray()
Verify that the actual value is a non-null
array, and return a new assertion object that provides dedicated array assertions for it.org.assertj.core.api.AbstractBooleanAssert<?>
Verify that the actual value is a non-null
Boolean
, and return a new assertion object that provides dedicatedBoolean
assertions for it.asMap()
Verify that the actual value is a non-null
JSON object, and return a new assertion object that provides dedicated assertions on individual elements of the object.org.assertj.core.api.AbstractObjectAssert<?,
Number> asNumber()
org.assertj.core.api.AbstractStringAssert<?>
asString()
Verify that the actual value is a non-null
String
, and return a new assertion object that provides dedicatedString
assertions for it.<T> org.assertj.core.api.AbstractObjectAssert<?,
T> Verify that the actual value can be converted to an instance of the giventarget
, and produce a new assertion object narrowed to that type.<T> org.assertj.core.api.AbstractObjectAssert<?,
T> convertTo
(ParameterizedTypeReference<T> target) Verify that the actual value can be converted to an instance of the giventarget
, and produce a new assertion object narrowed to that type.protected String
isEmpty()
Verify that the actual value is empty: either anull
scalar value or an empty list or map.Verify that the actual value is not empty: either a non-null
scalar value or a non-empty list or map.Methods inherited from class org.assertj.core.api.AbstractObjectAssert
as, as, doesNotReturn, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, getComparatorsByType, hasAllNullFieldsOrProperties, hasAllNullFieldsOrPropertiesExcept, hasFieldOrProperty, hasFieldOrPropertyWithValue, hasNoNullFieldsOrProperties, hasNoNullFieldsOrPropertiesExcept, hasOnlyFields, isEqualToComparingFieldByField, isEqualToComparingFieldByFieldRecursively, isEqualToComparingOnlyGivenFields, isEqualToIgnoringGivenFields, isEqualToIgnoringNullFields, newObjectAssert, returns, usingComparatorForFields, usingComparatorForType, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison
Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, 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, 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, describedAs, describedAs
-
Constructor Details
-
AbstractJsonValueAssert
-
-
Method Details
-
asString
public org.assertj.core.api.AbstractStringAssert<?> asString()Verify that the actual value is a non-null
String
, and return a new assertion object that provides dedicatedString
assertions for it.- Specified by:
asString
in interfaceorg.assertj.core.api.Assert<SELF extends AbstractJsonValueAssert<SELF>,
Object> - Overrides:
asString
in classorg.assertj.core.api.AbstractAssert<SELF extends AbstractJsonValueAssert<SELF>,
Object>
-
asNumber
-
asBoolean
public org.assertj.core.api.AbstractBooleanAssert<?> asBoolean()Verify that the actual value is a non-null
Boolean
, and return a new assertion object that provides dedicatedBoolean
assertions for it. -
asArray
Verify that the actual value is a non-null
array, and return a new assertion object that provides dedicated array assertions for it. -
asMap
Verify that the actual value is a non-null
JSON object, and return a new assertion object that provides dedicated assertions on individual elements of the object.The returned map assertion object uses attribute names as the keys, and the values can be any of the valid JSON values.
-
convertTo
Verify that the actual value can be converted to an instance of the giventarget
, and produce a new assertion object narrowed to that type.- Parameters:
target
- the type to convert the actual value to
-
convertTo
public <T> org.assertj.core.api.AbstractObjectAssert<?,T> convertTo(ParameterizedTypeReference<T> target) Verify that the actual value can be converted to an instance of the giventarget
, and produce a new assertion object narrowed to that type.- Parameters:
target
- the parameterized type to convert the actual value to
-
isEmpty
Verify that the actual value is empty: either anull
scalar value or an empty list or map.Can also be used when the path uses a filter operator to validate that it did not match.
-
isNotEmpty
Verify that the actual value is not empty: either a non-null
scalar value or a non-empty list or map.Can also be used when the path uses a filter operator to validate that it did match at least one element.
-
getExpectedErrorMessagePrefix
-