@Test public void shouldRetrieveMessages() { Map<String, String> msgs = new HashMap<>(); msgs.put("key1", "guten tag"); msgs.put("key2", "auf wiedersehen"); when(i18nRepository.getMessages(Locale.GERMAN)).thenReturn(msgs); when(cookieLocaleResolver.resolveLocale(request)).thenReturn(Locale.GERMAN); Map<String, String> result = localeService.getMessages(request); assertEquals(msgs, result); verify(i18nRepository).getMessages(Locale.GERMAN); }
@Override public Map<String, String> getMessages(HttpServletRequest request) { return i18nRepository.getMessages(getUserLocale(request)); }
LocaleServiceImpl implements LocaleService { @Override public Map<String, String> getMessages(HttpServletRequest request) { return i18nRepository.getMessages(getUserLocale(request)); } }
LocaleServiceImpl implements LocaleService { @Override public Map<String, String> getMessages(HttpServletRequest request) { return i18nRepository.getMessages(getUserLocale(request)); }  }
LocaleServiceImpl implements LocaleService { @Override public Map<String, String> getMessages(HttpServletRequest request) { return i18nRepository.getMessages(getUserLocale(request)); }  @Override Locale getUserLocale(final HttpServletRequest request); @Override void setUserLocale(final HttpServletRequest request, final HttpServletResponse response, final Locale locale); @Override void setSessionLocale(final HttpServletRequest request, final HttpServletResponse response, final Locale locale); @Override NavigableMap<String, String> getSupportedLanguages(); @Override Map<String, String> getMessages(HttpServletRequest request); }
LocaleServiceImpl implements LocaleService { @Override public Map<String, String> getMessages(HttpServletRequest request) { return i18nRepository.getMessages(getUserLocale(request)); }  @Override Locale getUserLocale(final HttpServletRequest request); @Override void setUserLocale(final HttpServletRequest request, final HttpServletResponse response, final Locale locale); @Override void setSessionLocale(final HttpServletRequest request, final HttpServletResponse response, final Locale locale); @Override NavigableMap<String, String> getSupportedLanguages(); @Override Map<String, String> getMessages(HttpServletRequest request);  }