Interface Assert

All Known Implementing Classes:
Routes

public interface Assert
a set of assertable things about the requests that the mock client handled. Each instance of an Assert represents one or more calls to a specific method/path
  • Method Summary

    Modifier and Type
    Method
    Description
    hadBody(String expected)
    Assert that any the request sent this body.
    hadField(String name, String value)
    Assert that any the request sent a multipart field
    hadHeader(String key, String value)
    Assert that any request to this method/path contained this header
    verify that all Expectations were fulfilled at least once.
    assert that this instance of method/path was invoked x times
  • Method Details

    • hadHeader

      Assert hadHeader(String key, String value)
      Assert that any request to this method/path contained this header
      Parameters:
      key - the expected header key
      value - the expected header value
      Returns:
      this Assert instance
      Throws:
      UnirestAssertion - when header does not exist
    • hadBody

      Assert hadBody(String expected)
      Assert that any the request sent this body. this only applies to non-multipart requests.
      Parameters:
      expected - the expected body
      Returns:
      this Assert instance
      Throws:
      UnirestAssertion - when body does not exist
    • hadField

      Assert hadField(String name, String value)
      Assert that any the request sent a multipart field
      Parameters:
      name - the field name
      value - the field value
      Returns:
      this Assert instance
      Throws:
      UnirestAssertion - when body does not exist
    • wasInvokedTimes

      Assert wasInvokedTimes(int i)
      assert that this instance of method/path was invoked x times
      Parameters:
      i - the number of times invoked.
      Returns:
      this Assert instance
      Throws:
      UnirestAssertion - when the invocation count is not x
    • verifyAll

      Assert verifyAll()
      verify that all Expectations were fulfilled at least once.
      Returns:
      this Assert instance
      Throws:
      UnirestAssertion - when all expectations have not been fulfilled