Class ResponseHeaderAssertion
java.lang.Object
org.apache.juneau.rest.client.assertion.ResponseHeaderAssertion
A fluent assertion class for a named HTTP response header.
Obtain instances via ResponseAssertion.header(String).
See Also:
- Since:
- 9.2.1
-
Method Summary
Modifier and TypeMethodDescriptionand()Returns the parentResponseAssertionto continue assertion chaining.Asserts that this header's value contains the given substring.Asserts that this header's value equals the expected value (case-sensitive).integerEquals(int expected) Asserts that this header's integer value equals the expected value.isAbsent()Asserts that this header is absent from the response.Asserts that this header is present in the response.startsWith(String prefix) Asserts that this header's value starts with the given prefix.
-
Method Details
-
isPresent
Asserts that this header is present in the response.- Returns:
- This object (for chaining).
- Throws:
AssertionError- If the header is absent.
-
isAbsent
Asserts that this header is absent from the response.- Returns:
- This object (for chaining).
- Throws:
AssertionError- If the header is present.
-
equals
Asserts that this header's value equals the expected value (case-sensitive).- Parameters:
expected- The expected value. Must not benull .- Returns:
- This object (for chaining).
- Throws:
AssertionError- If the value does not match.
-
contains
Asserts that this header's value contains the given substring.- Parameters:
substring- The substring to look for. Must not benull .- Returns:
- This object (for chaining).
- Throws:
AssertionError- If the value is absent or does not contain the substring.
-
startsWith
Asserts that this header's value starts with the given prefix.- Parameters:
prefix- The expected prefix. Must not benull .- Returns:
- This object (for chaining).
- Throws:
AssertionError- If the value is absent or does not start with the prefix.
-
integerEquals
Asserts that this header's integer value equals the expected value.- Parameters:
expected- The expected integer value.- Returns:
- This object (for chaining).
- Throws:
AssertionError- If the value is absent, not a number, or does not match.
-
and
Returns the parentResponseAssertionto continue assertion chaining.- Returns:
- The parent assertion. Never
null .
-