Package org.springframework.test.http
Class HttpHeadersAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractObjectAssert<HttpHeadersAssert,HttpHeaders>
org.springframework.test.http.HttpHeadersAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<HttpHeadersAssert,
,HttpHeaders> org.assertj.core.api.Descriptable<HttpHeadersAssert>
,org.assertj.core.api.ExtensionPoints<HttpHeadersAssert,
HttpHeaders>
public class HttpHeadersAssert
extends org.assertj.core.api.AbstractObjectAssert<HttpHeadersAssert,HttpHeaders>
AssertJ
assertions
that can be applied to
HttpHeaders
.- Since:
- 6.2
- Author:
- Stephane Nicoll, Simon Baslé
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncontainsHeader
(String name) Verify that the actual HTTP headers contain a header with the givenname
.containsHeaders
(String... names) Verify that the actual HTTP headers contain the headers with the givennames
.containsOnlyHeaders
(String... names) Verify that the actual HTTP headers contain only the headers with the givennames
, in any order and in a case-insensitive manner.doesNotContainHeader
(String name) Verify that the actual HTTP headers do not contain a header with the givenname
.doesNotContainHeaders
(String... names) Verify that the actual HTTP headers do not contain any of the headers with the givennames
.hasExactlyValues
(String name, List<String> values) Verify that the given header has a full list of values exactly equal to the given list of values, and in the same order.hasExactlyValuesInAnyOrder
(String name, List<String> values) Verify that the given header has a full list of values exactly equal to the given list of values, in any order.hasHeaderSatisfying
(String name, Consumer<List<String>> valueRequirements) Verify that the actual HTTP headers contain a header with the givenname
that satisfies the givenvalueRequirements
.hasSameSizeAs
(HttpHeaders other) Verify that the number of actual headers is the same as in the givenHttpHeaders
.hasSingleValue
(String name, long value) Verify that the actual HTTP headers contain a header with the givenname
andlong
primaryvalue
.hasSingleValue
(String name, String value) hasSingleValue
(String name, Instant value) hasSize
(int expected) Verify that there are exactlyexpected
headers present, when considering header names in a case-insensitive manner.Verify that the actual HTTP headers contain a header with the givenname
andlong
primaryvalue
.isEmpty()
Verify that the actual HTTP headers are empty and no header is present.Verify that the actual HTTP headers are not empty and at least one header is present.Methods inherited from class org.assertj.core.api.AbstractObjectAssert
as, as, doesNotReturn, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, getComparatorsByType, hasAllNullFieldsOrProperties, hasAllNullFieldsOrPropertiesExcept, hasFieldOrProperty, hasFieldOrPropertyWithValue, hasNoNullFieldsOrProperties, hasNoNullFieldsOrPropertiesExcept, hasOnlyFields, isEqualToComparingFieldByField, isEqualToComparingFieldByFieldRecursively, isEqualToComparingOnlyGivenFields, isEqualToIgnoringGivenFields, isEqualToIgnoringNullFields, newObjectAssert, returns, usingComparatorForFields, usingComparatorForType, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison
Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingEquals, usingEquals, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, describedAs, describedAs
-
Constructor Details
-
HttpHeadersAssert
-
-
Method Details
-
containsHeader
Verify that the actual HTTP headers contain a header with the givenname
.- Parameters:
name
- the name of an expected HTTP header
-
containsHeaders
Verify that the actual HTTP headers contain the headers with the givennames
.- Parameters:
names
- the names of expected HTTP headers
-
containsOnlyHeaders
Verify that the actual HTTP headers contain only the headers with the givennames
, in any order and in a case-insensitive manner.- Parameters:
names
- the names of expected HTTP headers- Since:
- 7.0
-
doesNotContainHeader
Verify that the actual HTTP headers do not contain a header with the givenname
.- Parameters:
name
- the name of an HTTP header that should not be present
-
doesNotContainHeaders
Verify that the actual HTTP headers do not contain any of the headers with the givennames
.- Parameters:
names
- the names of HTTP headers that should not be present- Since:
- 6.2.2
-
hasHeaderSatisfying
Verify that the actual HTTP headers contain a header with the givenname
that satisfies the givenvalueRequirements
.- Parameters:
name
- the name of the headervalueRequirements
- the group of assertions to run against the values of the header with the given name- Since:
- 7.0
-
hasValue
- Parameters:
name
- the name of the headervalue
- the expected value of the header
-
hasValue
Verify that the actual HTTP headers contain a header with the givenname
andlong
primaryvalue
.- Parameters:
name
- the name of the headervalue
- the expected value of the header
-
hasValue
- Parameters:
name
- the name of the headervalue
- the expected value of the header
-
hasSingleValue
Verify that the actual HTTP headers contain a header with the givenname
andString
primaryvalue
.This assertion fails if the header has secondary values.
- Parameters:
name
- the name of the headervalue
- the expected value of the header- Since:
- 7.0
-
hasSingleValue
Verify that the actual HTTP headers contain a header with the givenname
andlong
primaryvalue
.This assertion fails if the header has secondary values.
- Parameters:
name
- the name of the headervalue
- the expected value of the header- Since:
- 7.0
-
hasSingleValue
Verify that the actual HTTP headers contain a header with the givenname
andInstant
primaryvalue
.This assertion fails if the header has secondary values.
- Parameters:
name
- the name of the headervalue
- the expected value of the header- Since:
- 7.0
-
hasExactlyValues
Verify that the given header has a full list of values exactly equal to the given list of values, and in the same order.- Parameters:
name
- the considered header name (case-insensitive)values
- the exhaustive list of expected values- Since:
- 7.0
-
hasExactlyValuesInAnyOrder
Verify that the given header has a full list of values exactly equal to the given list of values, in any order.- Parameters:
name
- the considered header name (case-insensitive)values
- the exhaustive list of expected values- Since:
- 7.0
-
isEmpty
Verify that the actual HTTP headers are empty and no header is present. -
isNotEmpty
Verify that the actual HTTP headers are not empty and at least one header is present. -
hasSize
Verify that there are exactlyexpected
headers present, when considering header names in a case-insensitive manner.- Parameters:
expected
- the expected number of headers
-
hasSameSizeAs
Verify that the number of actual headers is the same as in the givenHttpHeaders
.- Parameters:
other
- theHttpHeaders
to compare size with- Since:
- 7.0
-