Class MockSyncHttpClient
- java.lang.Object
-
- software.amazon.awssdk.testutils.service.http.MockSyncHttpClient
-
- All Implemented Interfaces:
AutoCloseable,SdkHttpClient,MockHttpClient,SdkAutoCloseable
public final class MockSyncHttpClient extends Object implements SdkHttpClient, MockHttpClient
Mockable implementation ofSdkHttpClient.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface software.amazon.awssdk.http.SdkHttpClient
SdkHttpClient.Builder<T extends SdkHttpClient.Builder<T>>
-
-
Constructor Summary
Constructors Constructor Description MockSyncHttpClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()SdkHttpRequestgetLastRequest()Get the last request called on the mock.List<SdkHttpRequest>getRequests()Get all requests called on the mock.booleanisClosed()ExecutableHttpRequestprepareRequest(HttpExecuteRequest request)voidreset()Resets this mock by clearing any captured requests and wiping any stubbed responses.voidstubNextResponse(HttpExecuteResponse nextResponse)Sets up the next HTTP response that will be returned by the mock.voidstubNextResponse(HttpExecuteResponse nextResponse, Duration delay)Sets up the next HTTP response that will be returned by the mock with a delay.voidstubResponses(HttpExecuteResponse... responses)Sets the next set of HTTP responses that will be returned by the mock.voidstubResponses(Pair<HttpExecuteResponse,Duration>... responses)-
Methods inherited from class java.lang.Object
clone, equals, finalize, 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
-
-
-
-
Method Detail
-
prepareRequest
public ExecutableHttpRequest prepareRequest(HttpExecuteRequest request)
- Specified by:
prepareRequestin interfaceSdkHttpClient
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
reset
public void reset()
Description copied from interface:MockHttpClientResets this mock by clearing any captured requests and wiping any stubbed responses.- Specified by:
resetin interfaceMockHttpClient
-
stubNextResponse
public void stubNextResponse(HttpExecuteResponse nextResponse)
Description copied from interface:MockHttpClientSets up the next HTTP response that will be returned by the mock. Removes responses previously added to the mock.- Specified by:
stubNextResponsein interfaceMockHttpClient
-
stubNextResponse
public void stubNextResponse(HttpExecuteResponse nextResponse, Duration delay)
Description copied from interface:MockHttpClientSets up the next HTTP response that will be returned by the mock with a delay. Removes responses previously added to the mock.- Specified by:
stubNextResponsein interfaceMockHttpClient
-
stubResponses
public void stubResponses(Pair<HttpExecuteResponse,Duration>... responses)
- Specified by:
stubResponsesin interfaceMockHttpClient
-
stubResponses
public void stubResponses(HttpExecuteResponse... responses)
Description copied from interface:MockHttpClientSets the next set of HTTP responses that will be returned by the mock. Removes responses previously added to the mock.- Specified by:
stubResponsesin interfaceMockHttpClient
-
getRequests
public List<SdkHttpRequest> getRequests()
Description copied from interface:MockHttpClientGet all requests called on the mock.- Specified by:
getRequestsin interfaceMockHttpClient
-
getLastRequest
public SdkHttpRequest getLastRequest()
Description copied from interface:MockHttpClientGet the last request called on the mock.- Specified by:
getLastRequestin interfaceMockHttpClient
-
isClosed
public boolean isClosed()
-
-