public class StubClient extends Object implements Client, Closeable
clear()
method to clear previous request/response mappings.Modifier and Type | Class and Description |
---|---|
static class |
StubClient.NoMatchingResponseFoundException |
static class |
StubClient.RequestResponsePair |
class |
StubClient.StubbedResponseBuilder
Immutable response builder.
|
Constructor and Description |
---|
StubClient() |
StubClient(ScheduledExecutorService executor) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the previously setup request to response mappings, but not the history of sent messages.
|
void |
clearRequests()
Clears the requests and responses tracked by this client.
|
void |
close() |
List<StubClient.RequestResponsePair> |
requestsAndResponses()
Returns all the requests sent to this stub client, together with their associated responses.
|
StubClient.StubbedResponseBuilder |
respond(Response<okio.ByteString> response)
Configure a constant (i.e., all matching requests will always result in the same response)
response for some request.
|
StubClient.StubbedResponseBuilder |
respond(ResponseSource responseSource)
Configure a response source for matching requests.
|
CompletionStage<Response<okio.ByteString>> |
send(Request request)
Send a Request and get an asynchronous Response as a CompletionStage.
|
List<Request> |
sentRequests()
Returns all the requests sent to this stub client.
|
public StubClient()
public StubClient(ScheduledExecutorService executor)
public CompletionStage<Response<okio.ByteString>> send(Request request)
Client
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void clearRequests()
public List<StubClient.RequestResponsePair> requestsAndResponses()
public void clear()
public StubClient.StubbedResponseBuilder respond(Response<okio.ByteString> response)
public StubClient.StubbedResponseBuilder respond(ResponseSource responseSource)
Copyright © 2016. All rights reserved.