Class ResponseHeaderAssertion

java.lang.Object
org.apache.juneau.rest.client.assertion.ResponseHeaderAssertion

public final class ResponseHeaderAssertion extends Object
A fluent assertion class for a named HTTP response header.

Obtain instances via ResponseAssertion.header(String).

See Also:
Since:
9.2.1
  • 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 be null.
      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 be null.
      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 be null.
      Returns:
      This object (for chaining).
      Throws:
      AssertionError - If the value is absent or does not start with the prefix.
    • integerEquals

      public ResponseHeaderAssertion integerEquals(int expected)
      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 parent ResponseAssertion to continue assertion chaining.
      Returns:
      The parent assertion. Never null.