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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Verify that the given JSON path does not match.
    Verify that the given JSON path is present, and extract the JSON value for further assertions.
    Verify that the given JSON path matches.
    hasPathSatisfying(String path, Consumer<org.assertj.core.api.AssertProvider<JsonPathValueAssert>> valueRequirements)
    Verify that the given JSON path is present with a JSON value satisfying the given valueRequirements.

    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

  • Method Details

    • extractingPath

      public JsonPathValueAssert extractingPath(String path)
      Verify that the given JSON path is present, and extract the JSON value for further assertions.
      Parameters:
      path - the JsonPath expression
      See Also:
    • hasPathSatisfying

      public JsonPathAssert hasPathSatisfying(String path, Consumer<org.assertj.core.api.AssertProvider<JsonPathValueAssert>> valueRequirements)
      Verify that the given JSON path is present with a JSON value satisfying the given valueRequirements.
      Parameters:
      path - the JsonPath expression
      valueRequirements - a Consumer of the assertion object
    • hasPath

      public JsonPathAssert hasPath(String path)
      Verify that the given JSON path 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 - the JsonPath expression
    • doesNotHavePath

      public JsonPathAssert doesNotHavePath(String path)
      Verify that the given JSON path does not match.
      Parameters:
      path - the JsonPath expression