Package kong.unirest.core
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 TypeMethodDescriptionAssert that any the request sent this body.Assert that any the request sent a multipart fieldAssert that any request to this method/path contained this headerverify that all Expectations were fulfilled at least once.wasInvokedTimes
(int i) assert that this instance of method/path was invoked x times
-
Method Details
-
hadHeader
Assert that any request to this method/path contained this header- Parameters:
key
- the expected header keyvalue
- the expected header value- Returns:
- this Assert instance
- Throws:
UnirestAssertion
- when header does not exist
-
hadBody
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 that any the request sent a multipart field- Parameters:
name
- the field namevalue
- the field value- Returns:
- this Assert instance
- Throws:
UnirestAssertion
- when body does not exist
-
wasInvokedTimes
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
-