类 JsonPathRequestMatchers

java.lang.Object
cn.taketoday.test.web.client.match.JsonPathRequestMatchers

public class JsonPathRequestMatchers extends Object
Factory for assertions on the request content using JsonPath expressions.

An instance of this class is typically accessed via MockRestRequestMatchers.jsonPath(String, Matcher) or MockRestRequestMatchers.jsonPath(String, Object...).

从以下版本开始:
4.0
作者:
Rossen Stoyanchev, Sam Brannen
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • value

      public <T> RequestMatcher value(org.hamcrest.Matcher<? super T> matcher)
      Evaluate the JSON path expression against the request content and assert the resulting value with the given Hamcrest Matcher.
    • value

      public <T> RequestMatcher value(org.hamcrest.Matcher<? super T> matcher, Class<T> targetType)
      An overloaded variant of value(Matcher) that also accepts a target type for the resulting value that the matcher can work reliably against.

      This can be useful for matching numbers reliably — for example, to coerce an integer into a double.

      从以下版本开始:
      4.0
    • value

      public RequestMatcher value(Object expectedValue)
      Evaluate the JSON path expression against the request content and assert that the result is equal to the supplied value.
    • exists

      public RequestMatcher exists()
      Evaluate the JSON path expression against the request content and assert that a non-null value exists at the given path.

      If the JSON path expression is not definite, this method asserts that the value at the given path is not empty.

    • doesNotExist

      public RequestMatcher doesNotExist()
      Evaluate the JSON path expression against the request content and assert that a value does not exist at the given path.

      If the JSON path expression is not definite, this method asserts that the value at the given path is empty.

    • hasJsonPath

      public RequestMatcher hasJsonPath()
      Evaluate the JSON path expression against the response content and assert that a value, possibly null, exists.

      If the JSON path expression is not definite, this method asserts that the list of values at the given path is not empty.

      从以下版本开始:
      4.0
      另请参阅:
    • doesNotHaveJsonPath

      public RequestMatcher doesNotHaveJsonPath()
      Evaluate the JSON path expression against the supplied content and assert that a value, including null values, does not exist at the given path.

      If the JSON path expression is not definite, this method asserts that the list of values at the given path is empty.

      从以下版本开始:
      4.0
      另请参阅:
    • isEmpty

      public RequestMatcher isEmpty()
      Evaluate the JSON path expression against the request content and assert that an empty value exists at the given path.

      For the semantics of empty, consult the Javadoc for ObjectUtils.isEmpty(Object).

      从以下版本开始:
      4.0
      另请参阅:
    • isNotEmpty

      public RequestMatcher isNotEmpty()
      Evaluate the JSON path expression against the request content and assert that a non-empty value exists at the given path.

      For the semantics of empty, consult the Javadoc for ObjectUtils.isEmpty(Object).

      从以下版本开始:
      4.0
      另请参阅:
    • isString

      public RequestMatcher isString()
      Evaluate the JSON path expression against the request content and assert that the result is a String.
      从以下版本开始:
      4.0
    • isBoolean

      public RequestMatcher isBoolean()
      Evaluate the JSON path expression against the request content and assert that the result is a Boolean.
      从以下版本开始:
      4.0
    • isNumber

      public RequestMatcher isNumber()
      Evaluate the JSON path expression against the request content and assert that the result is a Number.
      从以下版本开始:
      4.0
    • isArray

      public RequestMatcher isArray()
      Evaluate the JSON path expression against the request content and assert that the result is an array.
    • isMap

      public RequestMatcher isMap()
      Evaluate the JSON path expression against the request content and assert that the result is a Map.
      从以下版本开始:
      4.0