org.springframework.test.web.servlet.result

## Class CookieResultMatchers

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

    public class CookieResultMatchers
    extends 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
`protected` `CookieResultMatchers()` Protected constructor.

### Method Summary

Methods
`ResultMatcher` `comment(String name, org.hamcrest.Matcher<? super String> matcher)` Assert a cookie's comment with a Hamcrest `Matcher`.
`ResultMatcher` `comment(String name, String comment)` Assert a cookie's comment value.
`ResultMatcher` `doesNotExist(String name)` Assert a cookie does not exist.
`ResultMatcher` `domain(String name, org.hamcrest.Matcher<? super String> matcher)` Assert a cookie's domain with a Hamcrest `Matcher`.
`ResultMatcher` `domain(String name, String domain)` Assert a cookie's domain value.
`ResultMatcher` `exists(String name)` Assert a cookie exists.
`ResultMatcher` `maxAge(String name, int maxAge)` Assert a cookie's maxAge value.
`ResultMatcher` `maxAge(String name, org.hamcrest.Matcher<? super Integer> matcher)` Assert a cookie's maxAge with a Hamcrest `Matcher`.
`ResultMatcher` `path(String name, org.hamcrest.Matcher<? super String> matcher)` Assert a cookie path with a Hamcrest `Matcher`.
`ResultMatcher` `path(String name, String path)`
`ResultMatcher` `secure(String name, boolean secure)` Assert whether the cookie must be sent over a secure protocol or not.
`ResultMatcher` `value(String name, org.hamcrest.Matcher<? super String> matcher)` Assert a cookie value with the given Hamcrest `Matcher`.
`ResultMatcher` `value(String name, String expectedValue)` Assert a cookie value.
`ResultMatcher` `version(String name, int version)` Assert a cookie's version value.
`ResultMatcher` `version(String name, org.hamcrest.Matcher<? super 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`

### Constructor Detail

#### CookieResultMatchers

    protected CookieResultMatchers()

Protected constructor. Use `MockMvcResultMatchers.cookie()`.

### Method Detail

#### value

    public ResultMatcher value(String name,
                      org.hamcrest.Matcher<? super String> matcher)

Assert a cookie value with the given Hamcrest `Matcher`.

#### value

    public ResultMatcher value(String name,
                      String expectedValue)

Assert a cookie value.

#### exists

    public ResultMatcher exists(String name)

Assert a cookie exists. The existence check is irrespective of whether max age is 0 (i.e. expired).

#### doesNotExist

    public ResultMatcher doesNotExist(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(String name,
                       org.hamcrest.Matcher<? super Integer> matcher)

Assert a cookie's maxAge with a Hamcrest `Matcher`.

#### maxAge

    public ResultMatcher maxAge(String name,
                       int maxAge)

Assert a cookie's maxAge value.

#### path

    public ResultMatcher path(String name,
                     org.hamcrest.Matcher<? super String> matcher)

Assert a cookie path with a Hamcrest `Matcher`.

#### path

    public ResultMatcher path(String name,
                     String path)

#### domain

    public ResultMatcher domain(String name,
                       org.hamcrest.Matcher<? super String> matcher)

Assert a cookie's domain with a Hamcrest `Matcher`.

#### domain

    public ResultMatcher domain(String name,
                       String domain)

Assert a cookie's domain value.

#### comment

    public ResultMatcher comment(String name,
                        org.hamcrest.Matcher<? super String> matcher)

Assert a cookie's comment with a Hamcrest `Matcher`.

#### comment

    public ResultMatcher comment(String name,
                        String comment)

Assert a cookie's comment value.

#### version

    public ResultMatcher version(String name,
                        org.hamcrest.Matcher<? super Integer> matcher)

Assert a cookie's version with a Hamcrest `Matcher`

#### version

    public ResultMatcher version(String name,
                        int version)

Assert a cookie's version value.

#### secure

    public ResultMatcher secure(String name,
                       boolean secure)

Assert whether the cookie must be sent over a secure protocol or not.