Class HttpHeaderMatcher
java.lang.Object
io.helidon.common.testing.http.junit5.HttpHeaderMatcher
Matchers for
Headers
.-
Method Summary
Modifier and TypeMethodDescriptionstatic org.hamcrest.Matcher
<Headers> A matcher for anHeaders
that checks that the header is present and has the defined value.static org.hamcrest.Matcher
<Headers> hasHeader
(HeaderName name) A matcher for anHeaders
that checks that the header is present, ignoring its value.static org.hamcrest.Matcher
<Headers> hasHeader
(HeaderName name, String... value) A matcher for anHeaders
that checks that the header is present and has the defined value(s).static org.hamcrest.Matcher
<Headers> hasHeader
(HeaderName name, org.hamcrest.Matcher<Iterable<? extends String>> valuesMatcher) A matcher for anHeaders
that checks that the header is present and values match the provided matcher.static org.hamcrest.Matcher
<Headers> hasHeaderValue
(HeaderName name, org.hamcrest.Matcher<String> valueMatcher) A matcher for anHeaders
that checks that the header is present and its single value matches the provided matcher.static org.hamcrest.Matcher
<Headers> noHeader
(HeaderName name) A matcher for anHeaders
that checks that the header is not present.
-
Method Details
-
noHeader
A matcher for anHeaders
that checks that the header is not present.Usage example:
assertThat(httpHeaders, noHeader(HeaderNames.CONNECTION));
- Parameters:
name
- header name- Returns:
- matcher validating the
Headers
does not contain the provided header
-
hasHeader
A matcher for anHeaders
that checks that the header is present, ignoring its value.Usage example:
assertThat(httpHeaders, hasHeader(HeaderNames.CONNECTION));
- Parameters:
name
- header name- Returns:
- matcher validating the
Headers
does contain the provided header regardless of its value(s)
-
hasHeader
A matcher for anHeaders
that checks that the header is present and has the defined value.Usage example:
assertThat(httpHeaders, hasHeader(HeaderValues.CONNECTION_CLOSE));
- Parameters:
header
- http header with values- Returns:
- matcher validating the
Headers
does contain the provided header
-
hasHeader
A matcher for anHeaders
that checks that the header is present and has the defined value(s).Usage example:
assertThat(httpHeaders, hasHeader(HeaderValues.REDIRECT, "/location"));
- Parameters:
name
- http header namevalue
- value(s) of the header- Returns:
- matcher validating the
Headers
does contain the provided header
-
hasHeader
public static org.hamcrest.Matcher<Headers> hasHeader(HeaderName name, org.hamcrest.Matcher<Iterable<? extends String>> valuesMatcher) A matcher for anHeaders
that checks that the header is present and values match the provided matcher.Usage example:
assertThat(httpHeaders, hasHeader(HeaderNames.CONNECTION, contains("close")));
- Parameters:
name
- header namevaluesMatcher
- matcher to validate the values are OK- Returns:
- matcher validating the
Headers
does contain the expected values
-
hasHeaderValue
public static org.hamcrest.Matcher<Headers> hasHeaderValue(HeaderName name, org.hamcrest.Matcher<String> valueMatcher) A matcher for anHeaders
that checks that the header is present and its single value matches the provided matcher.Usage example:
assertThat(httpHeaders, hasHeaderValue(HeaderNames.CONNECTION, startsWith("c")));
- Parameters:
name
- header namevalueMatcher
- matcher to validate the value is OK- Returns:
- matcher validating the
Headers
does contain the expected value
-