Package org.springframework.test.web.servlet

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


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


  /**
   * Evaluate the XPath and assert that content doesn't exist.
   */
  public ResultMatcher doesNotExist() {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.doesNotExist(content);
      }
View Full Code Here

  /**
   * Evaluate the XPath and assert the number of nodes found with the given
   * Hamcrest {@link Matcher}.
   */
  public ResultMatcher nodeCount(final Matcher<Integer> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.assertNodeCount(content, matcher);
      }
View Full Code Here

  /**
   * Evaluate the XPath and assert the number of nodes found.
   */
  public ResultMatcher nodeCount(final int expectedCount) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.assertNodeCount(content, expectedCount);
      }
View Full Code Here

  /**
   * Apply the XPath and assert the {@link String} value found with the given
   * Hamcrest {@link Matcher}.
   */
  public ResultMatcher string(final Matcher<? super String> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.assertString(content, matcher);
      }
View Full Code Here

  /**
   * Apply the XPath and assert the {@link String} value found.
   */
  public ResultMatcher string(final String expectedValue) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.assertString(content, expectedValue);
      }
View Full Code Here

  /**
   * Evaluate the XPath and assert the {@link Double} value found with the
   * given Hamcrest {@link Matcher}.
   */
  public ResultMatcher number(final Matcher<? super Double> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.assertNumber(content, matcher);
      }
View Full Code Here

  /**
   * Evaluate the XPath and assert the {@link Double} value found.
   */
  public ResultMatcher number(final Double expectedValue) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.assertNumber(content, expectedValue);
      }
View Full Code Here

  /**
   * Evaluate the XPath and assert the {@link Boolean} value found.
   */
  public ResultMatcher booleanValue(final Boolean value) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        String content = result.getResponse().getContentAsString();
        xpathHelper.assertBoolean(content, value);
      }
View Full Code Here

  /**
   * Assert a model attribute value with the given Hamcrest {@link Matcher}.
   */
  public <T> ResultMatcher attribute(final String name, final Matcher<T> matcher) {
    return new ResultMatcher() {
      @Override
      @SuppressWarnings("unchecked")
      public void match(MvcResult result) throws Exception {
        ModelAndView mav = getModelAndView(result);
        assertThat("Model attribute '" + name + "'", (T) mav.getModel().get(name), matcher);
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.