SystemExceptionResolver extends SimpleMappingExceptionResolver { protected void setExceptionInfo(Exception ex, HttpServletRequest request, HttpServletResponse response) { setExceptionCode(ex, request, response); setResultMessages(ex, request); }  void setExceptionCodeAttribute(String exceptionCodeAttribute); void setExceptionCodeHeader(String exceptionCodeHeader); void setResultMessagesAttribute(String resultMessagesAttribute); void setExceptionCodeResolver(
            ExceptionCodeResolver exceptionCodeResolver);  }
@Test public void testSetExceptionInfo() { FlashMap flashMap = new FlashMap(); mockRequest.setAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, flashMap); SimpleMappingExceptionCodeResolver exceptionCodeResolver = new SimpleMappingExceptionCodeResolver(); exceptionCodeResolver.setDefaultExceptionCode("defaultCode"); testTarget.setExceptionCodeResolver(exceptionCodeResolver); ResultMessages resultMessages = ResultMessages.error().add("code001"); BusinessException occurException = new BusinessException(resultMessages); testTarget.setExceptionInfo(occurException, mockRequest, mockResponse); assertThat(mockRequest.getAttribute("exceptionCode").toString(), is( "defaultCode")); assertThat(mockResponse.getHeader("X-Exception-Code"), is( "defaultCode")); assertThat(resultMessages, is(flashMap.get( ResultMessages.DEFAULT_MESSAGES_ATTRIBUTE_NAME))); }