### Question:
AmazonHttpClient { void resetRequestAfterError(Request<?> request, Exception cause) { if (request.getContent() == null) { return; } if (!request.getContent().markSupported()) { throw new AmazonClientException( "Encountered an exception and stream is not resettable", cause); } try { request.getContent().reset(); } catch (final IOException e) { throw new AmazonClientException( "Encountered an exception and couldn't reset the stream to retry", cause); } } AmazonHttpClient(ClientConfiguration config); @Deprecated  AmazonHttpClient(ClientConfiguration config,
            RequestMetricCollector requestMetricCollector);  AmazonHttpClient(ClientConfiguration config, HttpClient httpClient); @Deprecated  AmazonHttpClient(ClientConfiguration config, HttpClient httpClient,
            RequestMetricCollector requestMetricCollector); @Deprecated ResponseMetadata getResponseMetadataForRequest(AmazonWebServiceRequest request); Response<T> execute(Request<?> request,
            HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
            HttpResponseHandler<AmazonServiceException> errorResponseHandler,
            ExecutionContext executionContext); void shutdown(); RequestMetricCollector getRequestMetricCollector();  }### Answer:
@Test public void testResetRequestAfterErrorWithNullContent() { final Request<?> testRequest = new DefaultRequest<String>("test"); testRequest.setContent(null); Exception cause = new Exception(); client.resetRequestAfterError(testRequest, cause); }
@Test(expected = AmazonClientException.class) public void testResetRequestAfterErrorWithNonRepeatableContent() { final Request<?> testRequest = new DefaultRequest<String>("test"); testRequest.setContent(new InputStream() { @Override public boolean markSupported() { return false; } @Override public int read() throws IOException { return 0; } }); Exception cause = new Exception(); client.resetRequestAfterError(testRequest, cause); }
@Test(expected = AmazonClientException.class) public void testResetRequestAfterErrorWithNonResetableContent() { final Request<?> testRequest = new DefaultRequest<String>("test"); testRequest.setContent(new InputStream() { @Override public void reset() { throw new RuntimeException("CannotReset"); } @Override public int read() throws IOException { return 0; } }); Exception cause = new Exception(); client.resetRequestAfterError(testRequest, cause); }