@Test public void testSetResultMessages_BusinessException_flashMap_is_null() { ResultMessages resultMessages = ResultMessages.error().add("code01"); BusinessException occurException = new BusinessException(resultMessages); testTarget.setResultMessages(occurException, mockRequest); FlashMap flashMap = RequestContextUtils.getOutputFlashMap(mockRequest); assertThat(flashMap, is(nullValue())); }
protected void setResultMessages(Exception ex, HttpServletRequest request) { if (!StringUtils.hasText(resultMessagesAttribute)) { return; } if (!(ex instanceof ResultMessagesNotificationException)) { return; } ResultMessages resultMessages = ((ResultMessagesNotificationException) ex) .getResultMessages(); request.setAttribute(resultMessagesAttribute, resultMessages); FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request); if (flashMap != null) { flashMap.put(resultMessagesAttribute, resultMessages); } }
SystemExceptionResolver extends SimpleMappingExceptionResolver { protected void setResultMessages(Exception ex, HttpServletRequest request) { if (!StringUtils.hasText(resultMessagesAttribute)) { return; } if (!(ex instanceof ResultMessagesNotificationException)) { return; } ResultMessages resultMessages = ((ResultMessagesNotificationException) ex) .getResultMessages(); request.setAttribute(resultMessagesAttribute, resultMessages); FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request); if (flashMap != null) { flashMap.put(resultMessagesAttribute, resultMessages); } } }
SystemExceptionResolver extends SimpleMappingExceptionResolver { protected void setResultMessages(Exception ex, HttpServletRequest request) { if (!StringUtils.hasText(resultMessagesAttribute)) { return; } if (!(ex instanceof ResultMessagesNotificationException)) { return; } ResultMessages resultMessages = ((ResultMessagesNotificationException) ex) .getResultMessages(); request.setAttribute(resultMessagesAttribute, resultMessages); FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request); if (flashMap != null) { flashMap.put(resultMessagesAttribute, resultMessages); } }  }
SystemExceptionResolver extends SimpleMappingExceptionResolver { protected void setResultMessages(Exception ex, HttpServletRequest request) { if (!StringUtils.hasText(resultMessagesAttribute)) { return; } if (!(ex instanceof ResultMessagesNotificationException)) { return; } ResultMessages resultMessages = ((ResultMessagesNotificationException) ex) .getResultMessages(); request.setAttribute(resultMessagesAttribute, resultMessages); FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request); if (flashMap != null) { flashMap.put(resultMessagesAttribute, resultMessages); } }  void setExceptionCodeAttribute(String exceptionCodeAttribute); void setExceptionCodeHeader(String exceptionCodeHeader); void setResultMessagesAttribute(String resultMessagesAttribute); void setExceptionCodeResolver(
            ExceptionCodeResolver exceptionCodeResolver); }
SystemExceptionResolver extends SimpleMappingExceptionResolver { protected void setResultMessages(Exception ex, HttpServletRequest request) { if (!StringUtils.hasText(resultMessagesAttribute)) { return; } if (!(ex instanceof ResultMessagesNotificationException)) { return; } ResultMessages resultMessages = ((ResultMessagesNotificationException) ex) .getResultMessages(); request.setAttribute(resultMessagesAttribute, resultMessages); FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request); if (flashMap != null) { flashMap.put(resultMessagesAttribute, resultMessages); } }  void setExceptionCodeAttribute(String exceptionCodeAttribute); void setExceptionCodeHeader(String exceptionCodeHeader); void setResultMessagesAttribute(String resultMessagesAttribute); void setExceptionCodeResolver(
            ExceptionCodeResolver exceptionCodeResolver);  }