Class CookieResultMatchers
java.lang.Object
org.springframework.test.web.servlet.result.CookieResultMatchers
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 - 
Method Summary
Modifier and TypeMethodDescriptionAssert a cookie's specified attribute.Assert a cookie's specified attribute with a HamcrestMatcher.Assert a cookie's comment.Assert a cookie's comment with a HamcrestMatcher.doesNotExist(String name) Assert a cookie does not exist.Assert a cookie's domain.Assert a cookie's domain with a HamcrestMatcher.Assert a cookie exists.Assert whether the cookie must be HTTP only.Assert a cookie's maxAge.Assert a cookie's maxAge with a HamcrestMatcher.Assert a cookie's path.Assert a cookie's path with a HamcrestMatcher.Assert a cookie's SameSite attribute.Assert a cookie's SameSite attribute with a HamcrestMatcher.Assert whether the cookie must be sent over a secure protocol or not.Assert a cookie value.Assert a cookie value with the given HamcrestMatcher.Assert a cookie's version.Assert a cookie's version with a HamcrestMatcher. 
- 
Constructor Details
- 
CookieResultMatchers
protected CookieResultMatchers()Protected constructor. UseMockMvcResultMatchers.cookie(). 
 - 
 - 
Method Details
- 
value
Assert a cookie value with the given HamcrestMatcher. - 
value
Assert a cookie value. - 
exists
Assert a cookie exists. The existence check is irrespective of whether max age is 0 (i.e. expired). - 
doesNotExist
Assert a cookie does not exist. Note that the existence check is irrespective of whether max age is 0, i.e. expired. - 
maxAge
Assert a cookie's maxAge with a HamcrestMatcher. - 
maxAge
Assert a cookie's maxAge. - 
path
Assert a cookie's path with a HamcrestMatcher. - 
path
Assert a cookie's path. - 
domain
Assert a cookie's domain with a HamcrestMatcher. - 
domain
Assert a cookie's domain. - 
sameSite
Assert a cookie's SameSite attribute with a HamcrestMatcher.- Since:
 - 6.0.8
 - See Also:
 
 - 
sameSite
Assert a cookie's SameSite attribute.- Since:
 - 6.0.8
 - See Also:
 
 - 
comment
Assert a cookie's comment with a HamcrestMatcher. - 
comment
Assert a cookie's comment. - 
version
Assert a cookie's version with a HamcrestMatcher. - 
version
Assert a cookie's version. - 
secure
Assert whether the cookie must be sent over a secure protocol or not. - 
httpOnly
Assert whether the cookie must be HTTP only.- Since:
 - 4.3.9
 
 - 
attribute
public ResultMatcher attribute(String cookieName, String cookieAttribute, Matcher<? super String> matcher) Assert a cookie's specified attribute with a HamcrestMatcher.- Parameters:
 cookieAttribute- the name of the Cookie attribute (case-insensitive)- Since:
 - 6.0.8
 
 - 
attribute
Assert a cookie's specified attribute.- Parameters:
 cookieAttribute- the name of the Cookie attribute (case-insensitive)- Since:
 - 6.0.8
 
 
 -