类 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()
.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev, Thomas Bruyelle
构造器概要
构造器 限定符 构造器 说明 protected
CookieResultMatchers()
Protected constructor.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ResultMatcher
comment(String name, String comment)
Assert a cookie's comment value.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 value.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 value.ResultMatcher
maxAge(String name, Matcher<? super Integer> matcher)
Assert a cookie's maxAge with a HamcrestMatcher
.ResultMatcher
path(String name, String path)
ResultMatcher
path(String name, Matcher<? super String> matcher)
Assert a cookie 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 value.ResultMatcher
version(String name, Matcher<? super Integer> matcher)
Assert a cookie's version with a HamcrestMatcher
构造器详细资料
CookieResultMatchers
protected CookieResultMatchers()
Protected constructor. UseMockMvcResultMatchers.cookie()
.
方法详细资料
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 value.
path
public ResultMatcher path(String name, Matcher<? super String> matcher)
Assert a cookie path with a HamcrestMatcher
.
path
public ResultMatcher path(String name, String 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 value.
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 value.
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 value.
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.- 从以下版本开始:
- 4.3.9