public final class MockHttpClient extends Object implements SdkHttpClient
SdkHttpClient
.SdkHttpClient.Builder<T extends SdkHttpClient.Builder<T>>
Constructor and Description |
---|
MockHttpClient() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
<T> Optional<T> |
getConfigurationValue(SdkHttpConfigurationOption<T> key)
Retrieve the current value of the configuration option, if present.
|
SdkHttpFullRequest |
getLastRequest() |
AbortableCallable<SdkHttpFullResponse> |
prepareRequest(SdkHttpFullRequest request,
SdkRequestContext requestContext)
Create a
AbortableCallable 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(SdkHttpFullResponse nextResponse)
Sets up the next HTTP response that will be returned by the mock.
|
public AbortableCallable<SdkHttpFullResponse> prepareRequest(SdkHttpFullRequest request, SdkRequestContext requestContext)
SdkHttpClient
AbortableCallable
that can be used to execute the HTTP request.prepareRequest
in interface SdkHttpClient
request
- Representation of an HTTP request.requestContext
- Contains any extra dependencies needed.public <T> Optional<T> getConfigurationValue(SdkHttpConfigurationOption<T> key)
ConfigurationProvider
getConfigurationValue
in interface ConfigurationProvider
T
- Type of configuration value.key
- Key of configuration value to retrieve.Optional
if configuration option is not supported, otherwise a fulfilled Optional
containing the current value.public void close()
SdkAutoCloseable
close
in interface AutoCloseable
close
in interface SdkAutoCloseable
public void reset()
public void stubNextResponse(SdkHttpFullResponse nextResponse)
nextResponse
- Next SdkHttpFullResponse
to return from
prepareRequest(SdkHttpFullRequest, SdkRequestContext)
public SdkHttpFullRequest getLastRequest()
IllegalStateException
- If no requests have been captured.Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.