org.springframework.test.web.servlet.result

Class CookieResultMatchers

  • java.lang.Object
    • org.springframework.test.web.servlet.result.CookieResultMatchers


  • public class CookieResultMatchers
    extends java.lang.Object
    Factory for response cookie assertions.

    An instance of this class is typically accessed via MockMvcResultMatchers.cookie().

    Since:
    3.2
    Author:
    Rossen Stoyanchev, Thomas Bruyelle
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected CookieResultMatchers()
      Protected constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      ResultMatcher comment(java.lang.String name, org.hamcrest.Matcher<? super java.lang.String> matcher)
      Assert a cookie's comment with a Hamcrest Matcher.
      ResultMatcher comment(java.lang.String name, java.lang.String comment)
      Assert a cookie's comment value.
      ResultMatcher doesNotExist(java.lang.String name)
      Assert a cookie does not exist.
      ResultMatcher domain(java.lang.String name, org.hamcrest.Matcher<? super java.lang.String> matcher)
      Assert a cookie's domain with a Hamcrest Matcher.
      ResultMatcher domain(java.lang.String name, java.lang.String domain)
      Assert a cookie's domain value.
      ResultMatcher exists(java.lang.String name)
      Assert a cookie exists.
      ResultMatcher httpOnly(java.lang.String name, boolean httpOnly)
      Assert whether the cookie must be HTTP only.
      ResultMatcher maxAge(java.lang.String name, int maxAge)
      Assert a cookie's maxAge value.
      ResultMatcher maxAge(java.lang.String name, org.hamcrest.Matcher<? super java.lang.Integer> matcher)
      Assert a cookie's maxAge with a Hamcrest Matcher.
      ResultMatcher path(java.lang.String name, org.hamcrest.Matcher<? super java.lang.String> matcher)
      Assert a cookie path with a Hamcrest Matcher.
      ResultMatcher path(java.lang.String name, java.lang.String path) 
      ResultMatcher secure(java.lang.String name, boolean secure)
      Assert whether the cookie must be sent over a secure protocol or not.
      ResultMatcher value(java.lang.String name, org.hamcrest.Matcher<? super java.lang.String> matcher)
      Assert a cookie value with the given Hamcrest Matcher.
      ResultMatcher value(java.lang.String name, java.lang.String expectedValue)
      Assert a cookie value.
      ResultMatcher version(java.lang.String name, int version)
      Assert a cookie's version value.
      ResultMatcher version(java.lang.String name, org.hamcrest.Matcher<? super java.lang.Integer> matcher)
      Assert a cookie's version with a Hamcrest Matcher.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • value

        public ResultMatcher value(java.lang.String name,
                                   org.hamcrest.Matcher<? super java.lang.String> matcher)
        Assert a cookie value with the given Hamcrest Matcher.
      • value

        public ResultMatcher value(java.lang.String name,
                                   java.lang.String expectedValue)
        Assert a cookie value.
      • exists

        public ResultMatcher exists(java.lang.String name)
        Assert a cookie exists. The existence check is irrespective of whether max age is 0 (i.e. expired).
      • doesNotExist

        public ResultMatcher doesNotExist(java.lang.String name)
        Assert a cookie does not exist. Note that the existence check is irrespective of whether max age is 0, i.e. expired.
      • maxAge

        public ResultMatcher maxAge(java.lang.String name,
                                    org.hamcrest.Matcher<? super java.lang.Integer> matcher)
        Assert a cookie's maxAge with a Hamcrest Matcher.
      • maxAge

        public ResultMatcher maxAge(java.lang.String name,
                                    int maxAge)
        Assert a cookie's maxAge value.
      • path

        public ResultMatcher path(java.lang.String name,
                                  org.hamcrest.Matcher<? super java.lang.String> matcher)
        Assert a cookie path with a Hamcrest Matcher.
      • path

        public ResultMatcher path(java.lang.String name,
                                  java.lang.String path)
      • domain

        public ResultMatcher domain(java.lang.String name,
                                    org.hamcrest.Matcher<? super java.lang.String> matcher)
        Assert a cookie's domain with a Hamcrest Matcher.
      • domain

        public ResultMatcher domain(java.lang.String name,
                                    java.lang.String domain)
        Assert a cookie's domain value.
      • comment

        public ResultMatcher comment(java.lang.String name,
                                     org.hamcrest.Matcher<? super java.lang.String> matcher)
        Assert a cookie's comment with a Hamcrest Matcher.
      • comment

        public ResultMatcher comment(java.lang.String name,
                                     java.lang.String comment)
        Assert a cookie's comment value.
      • version

        public ResultMatcher version(java.lang.String name,
                                     org.hamcrest.Matcher<? super java.lang.Integer> matcher)
        Assert a cookie's version with a Hamcrest Matcher.
      • version

        public ResultMatcher version(java.lang.String name,
                                     int version)
        Assert a cookie's version value.
      • secure

        public ResultMatcher secure(java.lang.String name,
                                    boolean secure)
        Assert whether the cookie must be sent over a secure protocol or not.
      • httpOnly

        public ResultMatcher httpOnly(java.lang.String name,
                                      boolean httpOnly)
        Assert whether the cookie must be HTTP only.
        Since:
        4.3.9