类 HeaderResultMatchers
- java.lang.Object
- org.springframework.test.web.servlet.result.HeaderResultMatchers
public class HeaderResultMatchers extends Object
Factory for response header assertions.An instance of this class is available via
MockMvcResultMatchers.header()
.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev, Sam Brannen, Brian Clozel
构造器概要
构造器 限定符 构造器 说明 protected
HeaderResultMatchers()
Protected constructor.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ResultMatcher
dateValue(String name, long value)
Assert the primary value of the named response header as a date String, using the preferred date format described in RFC 7231.ResultMatcher
doesNotExist(String name)
Assert that the named response header does not exist.ResultMatcher
longValue(String name, long value)
Assert the primary value of the named response header as along
.ResultMatcher
string(String name, String value)
Assert the primary value of the response header as a String value.ResultMatcher
string(String name, Matcher<? super String> matcher)
Assert the primary value of the response header with the given Hamcrest StringMatcher
.ResultMatcher
stringValues(String name, String... values)
Assert the values of the response header as String values.<T> ResultMatcher
stringValues(String name, Matcher<Iterable<String>> matcher)
Assert the values of the response header with the given Hamcrest IterableMatcher
.
构造器详细资料
HeaderResultMatchers
protected HeaderResultMatchers()
Protected constructor. SeeMockMvcResultMatchers.header()
.
方法详细资料
string
public ResultMatcher string(String name, Matcher<? super String> matcher)
Assert the primary value of the response header with the given Hamcrest StringMatcher
.
stringValues
public <T> ResultMatcher stringValues(String name, Matcher<Iterable<String>> matcher)
Assert the values of the response header with the given Hamcrest IterableMatcher
.- 从以下版本开始:
- 4.3
string
public ResultMatcher string(String name, String value)
Assert the primary value of the response header as a String value.
stringValues
public ResultMatcher stringValues(String name, String... values)
Assert the values of the response header as String values.- 从以下版本开始:
- 4.3
doesNotExist
public ResultMatcher doesNotExist(String name)
Assert that the named response header does not exist.- 从以下版本开始:
- 4.0
longValue
public ResultMatcher longValue(String name, long value)
Assert the primary value of the named response header as along
.The
ResultMatcher
returned by this method throws anAssertionError
if the response does not contain the specified header, or if the suppliedvalue
does not match the primary value.
dateValue
public ResultMatcher dateValue(String name, long value)
Assert the primary value of the named response header as a date String, using the preferred date format described in RFC 7231.The
ResultMatcher
returned by this method throws anAssertionError
if the response does not contain the specified header, or if the suppliedvalue
does not match the primary value.- 从以下版本开始:
- 4.2
- 另请参阅:
- Section 7.1.1.1 of RFC 7231