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 Modifier Constructor Description protected
CookieResultMatchers()
Protected constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResultMatcher
comment(String name, String comment)
Assert a cookie's comment.ResultMatcher
comment(String name, Matcher<? super String> matcher)
Assert a cookie's comment with a HamcrestMatcher
.ResultMatcher
doesNotExist(String name)
Assert a cookie does not exist.ResultMatcher
domain(String name, String domain)
Assert a cookie's domain.ResultMatcher
domain(String name, Matcher<? super String> matcher)
Assert a cookie's domain with a HamcrestMatcher
.ResultMatcher
exists(String name)
Assert a cookie exists.ResultMatcher
httpOnly(String name, boolean httpOnly)
Assert whether the cookie must be HTTP only.ResultMatcher
maxAge(String name, int maxAge)
Assert a cookie's maxAge.ResultMatcher
maxAge(String name, Matcher<? super Integer> matcher)
Assert a cookie's maxAge with a HamcrestMatcher
.ResultMatcher
path(String name, String path)
Assert a cookie's path.ResultMatcher
path(String name, Matcher<? super String> matcher)
Assert a cookie's path with a HamcrestMatcher
.ResultMatcher
secure(String name, boolean secure)
Assert whether the cookie must be sent over a secure protocol or not.ResultMatcher
value(String name, String expectedValue)
Assert a cookie value.ResultMatcher
value(String name, Matcher<? super String> matcher)
Assert a cookie value with the given HamcrestMatcher
.ResultMatcher
version(String name, int version)
Assert a cookie's version.ResultMatcher
version(String name, Matcher<? super Integer> matcher)
Assert a cookie's version with a HamcrestMatcher
.
Constructor Detail
CookieResultMatchers
protected CookieResultMatchers()
Protected constructor. UseMockMvcResultMatchers.cookie()
.
Method Detail
value
public ResultMatcher value(String name, Matcher<? super String> matcher)
Assert a cookie value with the given HamcrestMatcher
.
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, Matcher<? super Integer> matcher)
Assert a cookie's maxAge with a HamcrestMatcher
.
maxAge
public ResultMatcher maxAge(String name, int maxAge)
Assert a cookie's maxAge.
path
public ResultMatcher path(String name, Matcher<? super String> matcher)
Assert a cookie's path with a HamcrestMatcher
.
path
public ResultMatcher path(String name, String path)
Assert a cookie's path.
domain
public ResultMatcher domain(String name, Matcher<? super String> matcher)
Assert a cookie's domain with a HamcrestMatcher
.
domain
public ResultMatcher domain(String name, String domain)
Assert a cookie's domain.
comment
public ResultMatcher comment(String name, Matcher<? super String> matcher)
Assert a cookie's comment with a HamcrestMatcher
.
comment
public ResultMatcher comment(String name, String comment)
Assert a cookie's comment.
version
public ResultMatcher version(String name, Matcher<? super Integer> matcher)
Assert a cookie's version with a HamcrestMatcher
.
version
public ResultMatcher version(String name, int version)
Assert a cookie's version.
secure
public ResultMatcher secure(String name, boolean secure)
Assert whether the cookie must be sent over a secure protocol or not.
httpOnly
public ResultMatcher httpOnly(String name, boolean httpOnly)
Assert whether the cookie must be HTTP only.- Since:
- 4.3.9