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 Details

    • hasValue

      default A hasValue(Object expected)
      Assert that the node has a value is equal to the given object
      Parameters:
      expected - the expected
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • isNull

      default A isNull()
      Assert that the path is null
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • isNotNull

      default A isNotNull()
      Assert that the path is not null
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • isMissing

      default A isMissing()
      Assert that the path is missing
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • isNotMissing

      default A isNotMissing()
      Assert that the path is not missing
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • isAnyNode

      default A isAnyNode()
      A missing node is not anything, everything else is
      Returns:
      the CoreJsonAssertion for 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 message
      customCondition - the condition
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • is

      default A is(Function<JsonNodeAssertDsl<A>,A> customisedBy)
      Add a set of custom assertions via a helper method or lambda
      Parameters:
      customisedBy - the fluent assertions
      Returns:
      the CoreJsonAssertion for 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 message
      customCondition - the condition
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • matches

      default A matches(org.hamcrest.Matcher<com.fasterxml.jackson.databind.JsonNode> matcher)
      Assert that the node matches a Hamcrest Matcher for JsonNode
      Parameters:
      matcher - the matcher
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added
    • number

      default NumberNodes<A> number()
      Switch to number context
      Returns:
      a subset of the DSL with just the numeric options
    • text

      default TextNodes<A> text()
      Switch to string context
      Returns:
      a subset of the DSL with just the numeric options
    • booleanNode

      default BooleanNodes<A> booleanNode()
      Switch to boolean context
      Returns:
      a subset of the DSL with just the boolean options
    • array

      default ArrayNodes<A> array()
      Switch to array context
      Returns:
      a subset of the DSL with just the boolean options
    • object

      default ObjectNodes<A> object()
      Switch to object context
      Returns:
      a subset of the DSL with just the boolean options
    • at

      default JsonAssertDslBuilders.At<A> at(String path)
      Start adding an JsonAssertDslBuilders.At expression to the assertion
      Parameters:
      path - the json path to use
      Returns:
      the JsonAssertDslBuilders.At to construct the at expression
    • isNotEmpty

      default A isNotEmpty()
      Depending on the type of node, this will detect emptiness
      Returns:
      the CoreJsonAssertion for fluent assertions, with this condition added