Class Invocation
java.lang.Object
kong.unirest.core.Invocation
- All Implemented Interfaces:
Expectation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Booleanprivate BodyMatcherprivate MatchStatusprivate Headersprivate Headersprivate ExpectedResponseRecordprivate Timesprivate Function<HttpRequest<?>, ExpectedResponse> private List<HttpRequest> private Routes -
Constructor Summary
ConstructorsConstructorDescriptionInvocation(Routes routes) Invocation(Routes routes, HttpRequest request) Invocation(Routes routes, Invocation other) -
Method Summary
Modifier and TypeMethodDescriptionprivate HeadersA expected body for a requestbody(BodyMatcher matcher) A matcher for the body for a requestprivate Stringdetails()(package private) RawResponsegetResponse(Config config, HttpRequest request) booleanbooleanhasExpectedHeader(String key, String value) booleanprivate booleanA expected header for a requestvoidlog(HttpRequest request) private IntegerqueryString(String key, String value) A expected header for a requestprivate intscoreBody(HttpRequest request) private intscoreHeaders(HttpRequest request) scoreMatch(HttpRequest request) private intscoreQuery(HttpRequest request) expect a null responsethenReturn(Object pojo) expect a object response as defined by a pojo using the requests / configuration object mapperthenReturn(String body) expect a string responsevoidthenReturn(Function<HttpRequest<?>, ExpectedResponse> fun) Allows for a full override of the way a expected response is built.thenReturn(Supplier<String> supplier) A supplier for the expected body which will get invoked at the time of build the response.thenReturn(JSONElement jsonObject) expect a json responseprivate static <T, M extends T>
Optional<M> private booleanuniBodyMatches(String body, Body o) voidverify()verify that all Expectations was fulfilled at least once.void
-
Field Details
-
routes
-
requests
-
expectedHeaders
-
expectedQueryParams
-
expected
-
expectedBody
-
expectedBodyStatus
-
expectedResponse
-
functionalResponse
-
expectedTimes
-
-
Constructor Details
-
Invocation
-
Invocation
-
Invocation
Invocation(Routes routes, Invocation other) -
Invocation
Invocation()
-
-
Method Details
-
thenReturn
Description copied from interface:Expectationexpect a string response- Specified by:
thenReturnin interfaceExpectation- Parameters:
body- the expected response body- Returns:
- The ExpectedResponse
-
thenReturn
Description copied from interface:Expectationexpect a json response- Specified by:
thenReturnin interfaceExpectation- Parameters:
jsonObject- the expected response body- Returns:
- The ExpectedResponse
-
thenReturn
Description copied from interface:Expectationexpect a object response as defined by a pojo using the requests / configuration object mapper- Specified by:
thenReturnin interfaceExpectation- Parameters:
pojo- the expected response body- Returns:
- The ExpectedResponse
-
thenReturn
Description copied from interface:ExpectationA supplier for the expected body which will get invoked at the time of build the response.- Specified by:
thenReturnin interfaceExpectation- Parameters:
supplier- the expected response body supplier- Returns:
- The ExpectedResponse
-
thenReturn
Description copied from interface:ExpectationAllows for a full override of the way a expected response is built. useful in building more complicated test-doubles of services that implement logic- Specified by:
thenReturnin interfaceExpectation- Parameters:
fun- the function to convert a request to a response
-
getResponse
-
allHeaders
-
log
-
header
Description copied from interface:ExpectationA expected header for a request- Specified by:
headerin interfaceExpectation- Parameters:
key- the header keyvalue- the header value- Returns:
- this Expectation
-
queryString
Description copied from interface:ExpectationA expected header for a request- Specified by:
queryStringin interfaceExpectation- Parameters:
key- the query keyvalue- the query value- Returns:
- this Expectation
-
body
Description copied from interface:ExpectationA expected body for a request- Specified by:
bodyin interfaceExpectation- Parameters:
body- the expected body- Returns:
- this Expectation
-
body
Description copied from interface:ExpectationA matcher for the body for a request- Specified by:
bodyin interfaceExpectation- Parameters:
matcher- the matcher- Returns:
- this Expectation
-
thenReturn
Description copied from interface:Expectationexpect a null response- Specified by:
thenReturnin interfaceExpectation- Returns:
- The ExpectedResponse
-
verify
public void verify()Description copied from interface:Expectationverify that all Expectations was fulfilled at least once.- Specified by:
verifyin interfaceExpectation
-
verify
- Specified by:
verifyin interfaceExpectation
-
times
- Specified by:
timesin interfaceExpectation
-
details
-
hasExpectedHeader
-
getBodyStream
-
hasBody
-
uniBodyMatches
-
hasField
-
hasField
-
requestSize
-
getRequests
-
isExpected
-
scoreMatch
-
scoreBody
-
matchBody
-
scoreHeaders
-
scoreQuery
-
tryCast
-