Package org.springframework.test.web.servlet

Examples of org.springframework.test.web.servlet.ResultMatcher


  /**
   * Evaluate the JSONPath and assert the value of the content found with the
   * given Hamcrest {@code Matcher}.
   */
  public <T> ResultMatcher value(final Matcher<T> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        jsonPathHelper.assertValue(content, matcher);
      }
View Full Code Here


  /**
   * Evaluate the JSONPath and assert the value of the content found.
   */
  public ResultMatcher value(final Object expectedValue) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        jsonPathHelper.assertValue(result.getResponse().getContentAsString(), expectedValue);
      }
    };
View Full Code Here

  /**
   * Evaluate the JSONPath and assert that content exists.
   */
  public ResultMatcher exists() {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        jsonPathHelper.exists(content);
      }
View Full Code Here

  /**
   * Evaluate the JSON path and assert not content was found.
   */
  public ResultMatcher doesNotExist() {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        jsonPathHelper.doesNotExist(content);
      }
View Full Code Here

  /**
   * Evluate the JSON path and assert the content found is an array.
   */
  public ResultMatcher isArray() {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        jsonPathHelper.assertValueIsArray(content);
      }
View Full Code Here

  /**
   * Assert the response status code with the given Hamcrest {@link Matcher}.
   */
  public ResultMatcher is(final Matcher<Integer> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        assertThat("Response status", result.getResponse().getStatus(), matcher);
      }
    };
View Full Code Here

  /**
   * Assert the response status code is equal to an integer value.
   */
  public ResultMatcher is(final int status) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        assertEquals("Response status", status, result.getResponse().getStatus());
      }
    };
View Full Code Here

  /**
   * Assert the response status code is in the 1xx range.
   */
  public ResultMatcher is1xxInformational() {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        assertEquals("Range for response status value " + result.getResponse().getStatus(),
            HttpStatus.Series.INFORMATIONAL, getHttpStatusSeries(result));
      }
View Full Code Here

  /**
   * Assert the response status code is in the 2xx range.
   */
  public ResultMatcher is2xxSuccessful() {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        assertEquals("Range for response status value " + result.getResponse().getStatus(),
            HttpStatus.Series.SUCCESSFUL, getHttpStatusSeries(result));
      }
View Full Code Here

  /**
   * Assert the response status code is in the 3xx range.
   */
  public ResultMatcher is3xxRedirection() {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        assertEquals("Range for response status value " + result.getResponse().getStatus(),
            HttpStatus.Series.REDIRECTION, getHttpStatusSeries(result));
      }
View Full Code Here

TOP

Related Classes of org.springframework.test.web.servlet.ResultMatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.