Class MockSyncHttpClient
java.lang.Object
software.amazon.awssdk.testutils.service.http.MockSyncHttpClient
- All Implemented Interfaces:
AutoCloseable
,SdkHttpClient
,MockHttpClient
,SdkAutoCloseable
Mockable implementation of
SdkHttpClient
.-
Nested Class Summary
Nested classes/interfaces inherited from interface software.amazon.awssdk.http.SdkHttpClient
SdkHttpClient.Builder<T extends SdkHttpClient.Builder<T>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Get the last request called on the mock.Get all requests called on the mock.boolean
isClosed()
prepareRequest
(HttpExecuteRequest request) Create aExecutableHttpRequest
that can be used to execute the HTTP request.void
reset()
Resets this mock by clearing any captured requests and wiping any stubbed responses.void
stubNextResponse
(HttpExecuteResponse nextResponse) Sets up the next HTTP response that will be returned by the mock.void
stubNextResponse
(HttpExecuteResponse nextResponse, Duration delay) Sets up the next HTTP response that will be returned by the mock with a delay.void
stubResponses
(HttpExecuteResponse... responses) Sets the next set of HTTP responses that will be returned by the mock.void
stubResponses
(Pair<HttpExecuteResponse, Duration>... responses) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.awssdk.testutils.service.http.MockHttpClient
stubNextResponse200
Methods inherited from interface software.amazon.awssdk.http.SdkHttpClient
clientName
-
Constructor Details
-
MockSyncHttpClient
public MockSyncHttpClient()
-
-
Method Details
-
prepareRequest
Description copied from interface:SdkHttpClient
Create aExecutableHttpRequest
that can be used to execute the HTTP request.- Specified by:
prepareRequest
in interfaceSdkHttpClient
- Parameters:
request
- Representation of an HTTP request.- Returns:
- Task that can execute an HTTP request and can be aborted.
-
close
public void close()Description copied from interface:SdkAutoCloseable
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSdkAutoCloseable
-
reset
public void reset()Description copied from interface:MockHttpClient
Resets this mock by clearing any captured requests and wiping any stubbed responses.- Specified by:
reset
in interfaceMockHttpClient
-
stubNextResponse
Description copied from interface:MockHttpClient
Sets up the next HTTP response that will be returned by the mock. Removes responses previously added to the mock.- Specified by:
stubNextResponse
in interfaceMockHttpClient
-
stubNextResponse
Description copied from interface:MockHttpClient
Sets up the next HTTP response that will be returned by the mock with a delay. Removes responses previously added to the mock.- Specified by:
stubNextResponse
in interfaceMockHttpClient
-
stubResponses
- Specified by:
stubResponses
in interfaceMockHttpClient
-
stubResponses
Description copied from interface:MockHttpClient
Sets the next set of HTTP responses that will be returned by the mock. Removes responses previously added to the mock.- Specified by:
stubResponses
in interfaceMockHttpClient
-
getRequests
Description copied from interface:MockHttpClient
Get all requests called on the mock.- Specified by:
getRequests
in interfaceMockHttpClient
-
getLastRequest
Description copied from interface:MockHttpClient
Get the last request called on the mock.- Specified by:
getLastRequest
in interfaceMockHttpClient
-
isClosed
public boolean isClosed()
-