public class HttpClientMockBuilder extends Object
| Modifier and Type | Method and Description |
|---|---|
HttpClientResponseBuilder |
doAction(Action action)
Adds custom action.
|
HttpClientResponseBuilder |
doReturn(int statusCode,
String response)
Adds action which returns provided response and status in UTF-8.
|
HttpClientResponseBuilder |
doReturn(int statusCode,
String response,
Charset charset)
Adds action which returns provided response in provided charset and status.
|
HttpClientResponseBuilder |
doReturn(String response)
Adds action which returns provided response in UTF-8 and status 200.
|
HttpClientResponseBuilder |
doReturn(String response,
Charset charset)
Adds action which returns provided response in provided charset and status 200.
|
HttpClientResponseBuilder |
doReturnJSON(String response)
Adds action which returns provided JSON in UTF-8 and status 200.
|
HttpClientResponseBuilder |
doReturnJSON(String response,
Charset charset)
Adds action which returns provided JSON in provided encoding and status 200.
|
HttpClientResponseBuilder |
doReturnStatus(int statusCode)
Adds action which returns empty message and provided status.
|
HttpClientResponseBuilder |
doReturnXML(String response)
Adds action which returns provided XML in UTF-8 and status 200.
|
HttpClientResponseBuilder |
doReturnXML(String response,
Charset charset)
Adds action which returns provided XML in UTF-8 and status 200.
|
HttpClientResponseBuilder |
doThrowException(IOException exception)
Adds action which throws provided exception.
|
HttpClientMockBuilder |
with(Condition condition)
Adds custom conditions.
|
HttpClientMockBuilder |
withBody(org.hamcrest.Matcher<String> matcher)
Adds body condition.
|
HttpClientMockBuilder |
withHeader(String header,
org.hamcrest.Matcher<String> matcher)
Adds header condition.
|
HttpClientMockBuilder |
withHeader(String header,
String value)
Adds header condition.
|
HttpClientMockBuilder |
withHost(String host)
Adds host condition.
|
HttpClientMockBuilder |
withParameter(String name,
org.hamcrest.Matcher<String> matcher)
Adds parameter condition.
|
HttpClientMockBuilder |
withParameter(String name,
String value)
Adds parameter condition.
|
HttpClientMockBuilder |
withPath(org.hamcrest.Matcher<String> matcher)
Adds path condition.
|
HttpClientMockBuilder |
withPath(String path)
Adds path condition.
|
HttpClientMockBuilder |
withReference(org.hamcrest.Matcher<String> matcher)
Adds reference condition.
|
HttpClientMockBuilder |
withReference(String reference)
Adds reference condition.
|
public HttpClientMockBuilder withHeader(String header, String value)
header - header namevalue - expected valuepublic HttpClientMockBuilder withHeader(String header, org.hamcrest.Matcher<String> matcher)
header - header namematcher - header value matcherpublic HttpClientMockBuilder withReference(String reference)
reference - expected referencepublic HttpClientMockBuilder withReference(org.hamcrest.Matcher<String> matcher)
matcher - reference matcherpublic HttpClientMockBuilder withParameter(String name, String value)
name - parameter namevalue - expected parameter valuepublic HttpClientMockBuilder withParameter(String name, org.hamcrest.Matcher<String> matcher)
name - parameter namematcher - parameter value matcherpublic HttpClientMockBuilder with(Condition condition)
condition - custom conditionpublic HttpClientMockBuilder withBody(org.hamcrest.Matcher<String> matcher)
matcher - custom conditionpublic HttpClientMockBuilder withHost(String host)
host - expected hostpublic HttpClientMockBuilder withPath(String path)
path - expected pathpublic HttpClientMockBuilder withPath(org.hamcrest.Matcher<String> matcher)
matcher - path matcherpublic HttpClientResponseBuilder doAction(Action action)
action - custom actionpublic HttpClientResponseBuilder doReturn(String response)
response - response to returnpublic HttpClientResponseBuilder doReturn(int statusCode, String response)
statusCode - status to returnresponse - response to returnpublic HttpClientResponseBuilder doReturn(String response, Charset charset)
response - response to returncharset - charset to returnpublic HttpClientResponseBuilder doReturn(int statusCode, String response, Charset charset)
statusCode - status to returnresponse - response to returncharset - the charsetpublic HttpClientResponseBuilder doReturnStatus(int statusCode)
statusCode - status to returnpublic HttpClientResponseBuilder doThrowException(IOException exception)
exception - exception to be thrownpublic HttpClientResponseBuilder doReturnJSON(String response)
response - JSON to returnpublic HttpClientResponseBuilder doReturnJSON(String response, Charset charset)
response - JSON to returnpublic HttpClientResponseBuilder doReturnXML(String response)
response - JSON to returnpublic HttpClientResponseBuilder doReturnXML(String response, Charset charset)
response - JSON to returnCopyright © 2018. All rights reserved.