### Question:
DefaultActionExceptionResolver implements ExceptionResolver<ResponseT> { @Override public <T> ResponseT handleException(Throwable exception, T action, Context context) throws InternalErrorException { this.exceptionClazz = exception.getClass(); this.actionClazz = action.getClass(); try { return responseWriter.writeResponse(handle(exception, action, context)); } catch (IOException e) { throw new InternalErrorException("Failed to write the error response", e); } } DefaultActionExceptionResolver(ResponseWriter<ResponseEntity<?>, ResponseT> responseWriter); @Override ResponseT handleException(Throwable exception, T action, Context context);  }### Answer:
@Test public void invokeUserDefinedExceptionHandlerTest() throws Exception { TestActionWithExceptionHandler action = new TestActionWithExceptionHandler(); AwsProxyResponse res = resolver.handleException( new TestActionWithExceptionHandler.HandledException("test exception"), action, mockContext); assertEquals(503, res.getStatusCode()); assertThat(res.getHeaders(), hasEntry(CONTENT_TYPE, APPLICATION_JSON)); TestErrorBody actual = JsonUtils.readValue(res.getBody(), TestErrorBody.class); assertEquals("Test Error test exception", actual.error); assertEquals("Test descrption", actual.description); assertFalse(res.isBase64Encoded()); }
@Test public void throwsExceptionWhenNotExistsExceptionHandlerTest() throws Exception { thrown.expect(InternalErrorException.class); thrown.expectMessage(startsWith("Not found any ExceptionHandler for")); TestActionWithoutExceptionHandler action = new TestActionWithoutExceptionHandler(); resolver.handleException( new RuntimeException("Occur exception test"), action, mockContext); }