Interface JsonNodeAssertDsl<A>
- Type Parameters:
A- the type of the ultimate assertion
- All Superinterfaces:
ArrayNodeDsl<A>,BooleanNodeDsl<A>,IsEqualToDsl<A>,NumberComparisonDsl<A>,NumberNodeDsl<A>,ObjectNodeDsl<A>,Satisfies<A>,Sizeable<A>,TextNodeDsl<A>,TreeComparisonDsl<A>
- All Known Implementing Classes:
AssertJson,ConditionList,CoreJsonAssertion,HamcrestJsonAssertion,HamcrestJsonAssertionBuilder,JsonAssertDslBuilders.At,PathDsl
public interface JsonNodeAssertDsl<A>
extends Satisfies<A>, TextNodeDsl<A>, NumberNodeDsl<A>, BooleanNodeDsl<A>, ObjectNodeDsl<A>, ArrayNodeDsl<A>, TreeComparisonDsl<A>
DSLs available on any JsonNode of unknown type. Aggregates all DSLs.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ArrayNodes<A>array()Switch to array contextdefault JsonAssertDslBuilders.At<A>Start adding anJsonAssertDslBuilders.Atexpression to the assertiondefault BooleanNodes<A>Switch to boolean contextdefault AAssert that the node has a value is equal to the given objectdefault AAdd a custom assertion conditiondefault Ais(Function<JsonNodeAssertDsl<A>, A> customisedBy) Add a set of custom assertions via a helper method or lambdadefault AA missing node is not anything, everything else isdefault AAssert that the path is missingdefault AAdd a custom assertion condition that must be falsedefault ADepending on the type of node, this will detect emptinessdefault AAssert that the path is not missingdefault AAssert that the path is not nulldefault AisNull()Assert that the path is nulldefault Amatches(org.hamcrest.Matcher<com.fasterxml.jackson.databind.JsonNode> matcher) Assert that the node matches a Hamcrest Matcher forJsonNodedefault NumberNodes<A>number()Switch to number contextdefault ObjectNodes<A>object()Switch to object contexttext()Switch to string contextMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.ArrayNodeDsl
isArray, isArrayContaining, isArrayContaining, isArrayContainingExactly, isArrayContainingExactly, isArrayContainingExactlyInAnyOrder, isArrayContainingExactlyInAnyOrder, isNotArray, satisfiesArrayConditionMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.BooleanNodeDsl
isBoolean, isFalse, isNotBoolean, isTrueMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.tree.IsEqualToDsl
isEqualTo, isEqualTo, isEqualTo, isEqualTo, isEqualTo, isEqualToYaml, isEqualToYaml, isEqualToYaml, isNotEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualTo, isNotEqualToYaml, isNotEqualToYaml, isNotEqualToYamlMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.NumberComparisonDsl
isBetween, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, isZero, satisfiesNumberConditionMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.NumberNodeDsl
isDouble, isGreaterThanDouble, isGreaterThanInt, isGreaterThanLong, isGreaterThanOrEqualToDouble, isGreaterThanOrEqualToInt, isGreaterThanOrEqualToLong, isInteger, isLessThanDouble, isLessThanInt, isLessThanLong, isLessThanOrEqualToDouble, isLessThanOrEqualToInt, isLessThanOrEqualToLong, isLong, isNotNumber, isNumber, isNumberEqualTo, isNumberNotEqualToMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.ObjectNodeDsl
containsKey, containsKeys, containsKeysExactly, containsKeysExactlyInAnyOrder, doesNotContainKey, doesNotContainKeys, isNotObject, isObject, satisfiesObjectConditionMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.Satisfies
satisfies, satisfiesMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.Sizeable
hasSize, isEmpty, sizeMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.TextNodeDsl
isEmptyText, isNotEmptyText, isNotText, isNotText, isText, isText, matches, matches, satisfiesTextCondition, textContains, textDoesNotContain, textDoesNotStartWith, textMatches, textStartsWithMethods inherited from interface uk.org.webcompere.modelassert.json.dsl.nodespecific.TreeComparisonDsl
isEqualTo, isNotEqualTo, where
-
Method Details
-
hasValue
Assert that the node has a value is equal to the given object- Parameters:
expected- the expected- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
isNull
Assert that the path is null- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
isNotNull
Assert that the path is not null- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
isMissing
Assert that the path is missing- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
isNotMissing
Assert that the path is not missing- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
isAnyNode
A missing node is not anything, everything else is- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
is
default A is(String description, Predicate<com.fasterxml.jackson.databind.JsonNode> customCondition) Add a custom assertion condition- Parameters:
description- the description for the failure messagecustomCondition- the condition- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
is
Add a set of custom assertions via a helper method or lambda- Parameters:
customisedBy- the fluent assertions- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
isNot
default A isNot(String description, Predicate<com.fasterxml.jackson.databind.JsonNode> customCondition) Add a custom assertion condition that must be false- Parameters:
description- the description for the failure messagecustomCondition- the condition- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
matches
Assert that the node matches a Hamcrest Matcher forJsonNode- Parameters:
matcher- the matcher- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-
number
Switch to number context- Returns:
- a subset of the DSL with just the numeric options
-
text
Switch to string context- Returns:
- a subset of the DSL with just the numeric options
-
booleanNode
Switch to boolean context- Returns:
- a subset of the DSL with just the boolean options
-
array
Switch to array context- Returns:
- a subset of the DSL with just the boolean options
-
object
Switch to object context- Returns:
- a subset of the DSL with just the boolean options
-
at
Start adding anJsonAssertDslBuilders.Atexpression to the assertion- Parameters:
path- the json path to use- Returns:
- the
JsonAssertDslBuilders.Atto construct the at expression
-
isNotEmpty
Depending on the type of node, this will detect emptiness- Returns:
- the
CoreJsonAssertionfor fluent assertions, with this condition added
-