@Test public void addFeedbackMessage() { RedirectAttributes model = new RedirectAttributesModelMap(); Object[] params = new Object[0]; when(messageSourceMock.getMessage(eq(FEEDBACK_MESSAGE_CODE), eq(params), any(Locale.class))).thenReturn(FEEDBACK_MESSAGE); controller.addFeedbackMessage(model, FEEDBACK_MESSAGE_CODE, params); verify(messageSourceMock, times(1)).getMessage(eq(FEEDBACK_MESSAGE_CODE), eq(params), any(Locale.class)); verifyNoMoreInteractions(messageSourceMock); String feedbackMessage = (String) model.getFlashAttributes().get(FLASH_FEEDBACK_MESSAGE); assertEquals(FEEDBACK_MESSAGE, feedbackMessage); }
protected void addFeedbackMessage(RedirectAttributes model, String code, Object... params) { LOGGER.debug("Adding feedback message with code: " + code + " and params: " + params); Locale current = LocaleContextHolder.getLocale(); LOGGER.debug("Current locale is " + current); String localizedFeedbackMessage = messageSource.getMessage(code, params, current); LOGGER.debug("Localized message is: " + localizedFeedbackMessage); model.addFlashAttribute(FLASH_FEEDBACK_MESSAGE, localizedFeedbackMessage); }
AbstractController { protected void addFeedbackMessage(RedirectAttributes model, String code, Object... params) { LOGGER.debug("Adding feedback message with code: " + code + " and params: " + params); Locale current = LocaleContextHolder.getLocale(); LOGGER.debug("Current locale is " + current); String localizedFeedbackMessage = messageSource.getMessage(code, params, current); LOGGER.debug("Localized message is: " + localizedFeedbackMessage); model.addFlashAttribute(FLASH_FEEDBACK_MESSAGE, localizedFeedbackMessage); } }
AbstractController { protected void addFeedbackMessage(RedirectAttributes model, String code, Object... params) { LOGGER.debug("Adding feedback message with code: " + code + " and params: " + params); Locale current = LocaleContextHolder.getLocale(); LOGGER.debug("Current locale is " + current); String localizedFeedbackMessage = messageSource.getMessage(code, params, current); LOGGER.debug("Localized message is: " + localizedFeedbackMessage); model.addFlashAttribute(FLASH_FEEDBACK_MESSAGE, localizedFeedbackMessage); }  }
AbstractController { protected void addFeedbackMessage(RedirectAttributes model, String code, Object... params) { LOGGER.debug("Adding feedback message with code: " + code + " and params: " + params); Locale current = LocaleContextHolder.getLocale(); LOGGER.debug("Current locale is " + current); String localizedFeedbackMessage = messageSource.getMessage(code, params, current); LOGGER.debug("Localized message is: " + localizedFeedbackMessage); model.addFlashAttribute(FLASH_FEEDBACK_MESSAGE, localizedFeedbackMessage); }   }
AbstractController { protected void addFeedbackMessage(RedirectAttributes model, String code, Object... params) { LOGGER.debug("Adding feedback message with code: " + code + " and params: " + params); Locale current = LocaleContextHolder.getLocale(); LOGGER.debug("Current locale is " + current); String localizedFeedbackMessage = messageSource.getMessage(code, params, current); LOGGER.debug("Localized message is: " + localizedFeedbackMessage); model.addFlashAttribute(FLASH_FEEDBACK_MESSAGE, localizedFeedbackMessage); }    }