Class HeaderResultMatchers
java.lang.Object
org.springframework.test.web.servlet.result.HeaderResultMatchers
Factory for response header assertions.
An instance of this class is available via
MockMvcResultMatchers.header()
.
- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Sam Brannen, Brian Clozel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAssert the primary value of the named response header parsed into a date using the preferred date format described in RFC 7231.doesNotExist
(String name) Assert that the named response header does not exist.Assert that the named response header exists.Assert the primary value of the named response header as along
.Assert the primary value of the response header as a String value.Assert the primary value of the response header with the given Hamcrest StringMatcher
.stringValues
(String name, String... values) Assert the values of the response header as String values.stringValues
(String name, Matcher<? super Iterable<String>> matcher) Assert the values of the response header with the given Hamcrest IterableMatcher
.
-
Constructor Details
-
HeaderResultMatchers
protected HeaderResultMatchers()Protected constructor. SeeMockMvcResultMatchers.header()
.
-
-
Method Details
-
string
Assert the primary value of the response header with the given Hamcrest StringMatcher
. -
stringValues
Assert the values of the response header with the given Hamcrest IterableMatcher
.- Since:
- 4.3
-
string
Assert the primary value of the response header as a String value. -
stringValues
Assert the values of the response header as String values.- Since:
- 4.3
-
exists
Assert that the named response header exists.- Since:
- 5.0.3
-
doesNotExist
Assert that the named response header does not exist.- Since:
- 4.0
-
longValue
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
Assert the primary value of the named response header parsed into a date 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.- Since:
- 4.2
- See Also:
-