### Question:
DefaultErrorResponseHandler implements HttpResponseHandler<AmazonServiceException> { public DefaultErrorResponseHandler( List<Unmarshaller<AmazonServiceException, Node>> unmarshallerList) { this.unmarshallerList = unmarshallerList; } DefaultErrorResponseHandler(
            List<Unmarshaller<AmazonServiceException, Node>> unmarshallerList); @Override AmazonServiceException handle(HttpResponse errorResponse); @Override boolean needsConnectionLeftOpen();  }### Answer:
@Test public void testDefaultErrorResponseHandler() throws Exception { List<Unmarshaller<AmazonServiceException, Node>> unmarshallerList = new ArrayList<Unmarshaller<AmazonServiceException, Node>>(); String xmlResponse = "<error>TestError</error>"; HttpResponse errorResponse = new HttpResponse.Builder() .statusCode(400) .statusText("Error") .content(new ByteArrayInputStream(xmlResponse.getBytes(StringUtils.UTF8))) .build(); final List<Boolean> called = new ArrayList<Boolean>(); Unmarshaller<AmazonServiceException, Node> incorrectUnmarshaller = new Unmarshaller<AmazonServiceException, Node>() { @Override public AmazonServiceException unmarshall(Node in) throws Exception { called.add(true); return null; } }; Unmarshaller<AmazonServiceException, Node> correctUnmarshaller = new Unmarshaller<AmazonServiceException, Node>() { @Override public AmazonServiceException unmarshall(Node in) throws Exception { called.add(true); in = in.getFirstChild(); assertEquals(in.getNodeName(), "error"); assertEquals( in.getTextContent(), "TestError"); AmazonServiceException ase = new AmazonServiceException("TestAse"); return ase; } }; unmarshallerList.add(incorrectUnmarshaller); unmarshallerList.add(correctUnmarshaller); DefaultErrorResponseHandler handler = new DefaultErrorResponseHandler(unmarshallerList); AmazonServiceException e = handler.handle(errorResponse); assertEquals(e.getErrorMessage(), "TestAse"); assertEquals(e.getStatusCode(), 400); assertEquals(called.size(), 2); assertTrue(called.get(0)); assertTrue(called.get(1)); }