Package kong.unirest.core
Interface Assert
-
- All Known Implementing Classes:
Routes
public interface Asserta 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AsserthadBody(java.lang.String expected)Assert that any the request sent this body.AsserthadField(java.lang.String name, java.lang.String value)Assert that any the request sent a multipart fieldAsserthadHeader(java.lang.String key, java.lang.String value)Assert that any request to this method/path contained this headerAssertverifyAll()verify that all Expectations were fulfilled at least once.AssertwasInvokedTimes(int i)assert that this instance of method/path was invoked x times
-
-
-
Method Detail
-
hadHeader
Assert hadHeader(java.lang.String key, java.lang.String value)
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 hadBody(java.lang.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(java.lang.String name, java.lang.String value)
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 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
-
-