use of com.amazonaws.transform.Unmarshaller in project aws-sdk-android by aws-amplify.
the class DefaultErrorResponseHandlerTest method testDefaultErrorResponseHandlerCannotGetContent.
@Test
public void testDefaultErrorResponseHandlerCannotGetContent() throws Exception {
List<Unmarshaller<AmazonServiceException, Node>> unmarshallerList = new ArrayList<Unmarshaller<AmazonServiceException, Node>>();
HttpResponse errorResponse = new HttpResponse.Builder().statusCode(400).statusText("Error").content(new InputStream() {
@Override
public int read() throws IOException {
throw new IOException("Test IOException");
}
}).build();
DefaultErrorResponseHandler handler = new DefaultErrorResponseHandler(unmarshallerList);
AmazonServiceException e = handler.handle(errorResponse);
assertEquals(e.getErrorCode(), errorResponse.getStatusCode() + " " + errorResponse.getStatusText());
assertEquals(e.getStatusCode(), 400);
assertEquals(e.getErrorType(), ErrorType.Unknown);
}
Aggregations