Package org.springframework.test.web.servlet

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


  /**
   * Assert a cookie's maxAge value.
   */
  public ResultMatcher maxAge(final String name, final int maxAge) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) {
        Cookie cookie = result.getResponse().getCookie(name);
        assertTrue("No cookie with name: " + name, cookie != null);
        assertEquals("Response cookie maxAge", maxAge, cookie.getMaxAge());
View Full Code Here


  /**
   * Assert a cookie path with a Hamcrest {@link Matcher}.
   */
  public ResultMatcher path(final String name, final Matcher<? super String> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertThat("Response cookie path", cookie.getPath(), matcher);
      }
View Full Code Here

      }
    };
  }

  public ResultMatcher path(final String name, final String path) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertEquals("Response cookie path", path, cookie.getPath());
      }
View Full Code Here

  /**
   * Assert a cookie's domain with a Hamcrest {@link Matcher}.
   */
  public ResultMatcher domain(final String name, final Matcher<? super String> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertThat("Response cookie domain", cookie.getDomain(), matcher);
      }
View Full Code Here

  /**
   * Assert a cookie's domain value.
   */
  public ResultMatcher domain(final String name, final String domain) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertEquals("Response cookie domain", domain, cookie.getDomain());
      }
View Full Code Here

  /**
   * Assert a cookie's comment with a Hamcrest {@link Matcher}.
   */
  public ResultMatcher comment(final String name, final Matcher<? super String> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertThat("Response cookie comment", cookie.getComment(), matcher);
      }
View Full Code Here

  /**
   * Assert a cookie's comment value.
   */
  public ResultMatcher comment(final String name, final String comment) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertEquals("Response cookie comment", comment, cookie.getComment());
      }
View Full Code Here

  /**
   * Assert a cookie's version with a Hamcrest {@link Matcher}
   */
  public ResultMatcher version(final String name, final Matcher<? super Integer> matcher) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertThat("Response cookie version", cookie.getVersion(), matcher);
      }
View Full Code Here

  /**
   * Assert a cookie's version value.
   */
  public ResultMatcher version(final String name, final int version) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertEquals("Response cookie version", version, cookie.getVersion());
      }
View Full Code Here

  /**
   * Assert whether the cookie must be sent over a secure protocol or not.
   */
  public ResultMatcher secure(final String name, final boolean secure) {
    return new ResultMatcher() {
      @Override
      public void match(MvcResult result) throws Exception {
        Cookie cookie = result.getResponse().getCookie(name);
        assertEquals("Response cookie secure", secure, cookie.getSecure());
      }
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.