JsonPathRequestMatchers (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.test.web.client.match

## Class JsonPathRequestMatchers

- java.lang.Object
- - org.springframework.test.web.client.match.JsonPathRequestMatchers

-     public class JsonPathRequestMatchers
      extends Object

  Factory methods for request content `RequestMatcher`'s using a JSONPath expression. An instance of this class is typically accessed via `RequestMatchers.jsonPath(..)`.
  Since:
    3.2
  Author:
    Rossen Stoyanchev

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JsonPathRequestMatchers(String expression, Object... args)` Class constructor, not for direct instantiation.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RequestMatcher` | `doesNotExist()` Evaluate the JSON path and assert the resulting content exists.
    `RequestMatcher` | `exists()` Apply the JSONPath and assert the resulting value.
    `RequestMatcher` | `isArray()` Assert the content at the given JSONPath is an array.
    `<T> RequestMatcher` | `value(org.hamcrest.Matcher<T> matcher)` Evaluate the JSONPath and assert the resulting value with the given `Matcher`.
    `RequestMatcher` | `value(Object expectedValue)` Apply the JSONPath and assert the resulting value.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JsonPathRequestMatchers

          protected JsonPathRequestMatchers(String expression,
                                 Object... args)

      Class constructor, not for direct instantiation. Use `MockRestRequestMatchers.jsonPath(String, Matcher)` or `MockRestRequestMatchers.jsonPath(String, Object...)`.
      Parameters:
        `expression` - the JSONPath expression
        `args` - arguments to parameterize the JSONPath expression with using the formatting specifiers defined in `String.format(String, Object...)`

  - ### Method Detail

    - #### value

          public <T> RequestMatcher value(org.hamcrest.Matcher<T> matcher)

      Evaluate the JSONPath and assert the resulting value with the given `Matcher`.

    - #### value

          public RequestMatcher value(Object expectedValue)

      Apply the JSONPath and assert the resulting value.

    - #### exists

          public RequestMatcher exists()

      Apply the JSONPath and assert the resulting value.

    - #### doesNotExist

          public RequestMatcher doesNotExist()

      Evaluate the JSON path and assert the resulting content exists.

    - #### isArray

          public RequestMatcher isArray()

      Assert the content at the given JSONPath is an array.