public class HeaderResultMatchers extends Object
An instance of this class is available via
MockMvcResultMatchers.header()
.
Modifier | Constructor and Description |
---|---|
protected |
HeaderResultMatchers()
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
ResultMatcher |
dateValue(String name,
long value)
Assert the primary value of the named response header parsed into a date
using the preferred date format described in RFC 7231.
|
ResultMatcher |
doesNotExist(String name)
Assert that the named response header does not exist.
|
ResultMatcher |
exists(String name)
Assert that the named response header exists.
|
ResultMatcher |
longValue(String name,
long value)
Assert the primary value of the named response header as a
long . |
ResultMatcher |
string(String name,
Matcher<? super String> matcher)
Assert the primary value of the response header with the given Hamcrest
String
Matcher . |
ResultMatcher |
string(String name,
String value)
Assert the primary value of the response header as a String value.
|
ResultMatcher |
stringValues(String name,
Matcher<? super Iterable<String>> matcher)
Assert the values of the response header with the given Hamcrest
Iterable
Matcher . |
ResultMatcher |
stringValues(String name,
String... values)
Assert the values of the response header as String values.
|
protected HeaderResultMatchers()
MockMvcResultMatchers.header()
.public ResultMatcher string(String name, Matcher<? super String> matcher)
Matcher
.public ResultMatcher stringValues(String name, Matcher<? super Iterable<String>> matcher)
Matcher
.public ResultMatcher string(String name, String value)
public ResultMatcher stringValues(String name, String... values)
public ResultMatcher exists(String name)
public ResultMatcher doesNotExist(String name)
public ResultMatcher longValue(String name, long value)
long
.
The ResultMatcher
returned by this method throws an
AssertionError
if the response does not contain the specified
header, or if the supplied value
does not match the primary value.
public ResultMatcher dateValue(String name, long value)
The ResultMatcher
returned by this method throws an
AssertionError
if the response does not contain the specified
header, or if the supplied value
does not match the primary value.