use of software.amazon.awssdk.http.ExecutableHttpRequest in project aws-xray-sdk-java by aws.
the class TracingInterceptorTest method mockSdkHttpClient.
private SdkHttpClient mockSdkHttpClient(SdkHttpResponse response, String body) throws Exception {
ExecutableHttpRequest abortableCallable = Mockito.mock(ExecutableHttpRequest.class);
SdkHttpClient mockClient = Mockito.mock(SdkHttpClient.class);
when(mockClient.prepareRequest(Mockito.any())).thenReturn(abortableCallable);
when(abortableCallable.call()).thenReturn(HttpExecuteResponse.builder().response(response).responseBody(AbortableInputStream.create(new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)))).build());
return mockClient;
}
Aggregations