@Test public void shouldGetLocales() { mockStatic(RequestContextUtils.class); when(RequestContextUtils.getLocale(request)).thenReturn(Locale.getDefault()); Set<String> localeMap = new HashSet<>(); localeMap.add("pt"); localeMap.add("en"); when(messageService.getLocales()).thenReturn(localeMap); ResponseEntity<OpenLmisResponse> locales = homeController.getLocales(request); Set<String> foundLocales = (Set<String>) locales.getBody().getData().get("locales"); assertThat(foundLocales, is(localeMap)); }
@RequestMapping(value = "/locales", method = GET) public ResponseEntity<OpenLmisResponse> getLocales(HttpServletRequest request) { messageService.setCurrentLocale(RequestContextUtils.getLocale(request)); return response("locales", messageService.getLocales()); }
HomeController extends BaseController { @RequestMapping(value = "/locales", method = GET) public ResponseEntity<OpenLmisResponse> getLocales(HttpServletRequest request) { messageService.setCurrentLocale(RequestContextUtils.getLocale(request)); return response("locales", messageService.getLocales()); } }
HomeController extends BaseController { @RequestMapping(value = "/locales", method = GET) public ResponseEntity<OpenLmisResponse> getLocales(HttpServletRequest request) { messageService.setCurrentLocale(RequestContextUtils.getLocale(request)); return response("locales", messageService.getLocales()); }  }
HomeController extends BaseController { @RequestMapping(value = "/locales", method = GET) public ResponseEntity<OpenLmisResponse> getLocales(HttpServletRequest request) { messageService.setCurrentLocale(RequestContextUtils.getLocale(request)); return response("locales", messageService.getLocales()); }  @RequestMapping(value = "", method = GET) String homeDefault(); @RequestMapping(value = "/locales", method = GET) ResponseEntity<OpenLmisResponse> getLocales(HttpServletRequest request); @RequestMapping(value = "/changeLocale", method = PUT, headers = ACCEPT_JSON) void changeLocale(HttpServletRequest request); }
HomeController extends BaseController { @RequestMapping(value = "/locales", method = GET) public ResponseEntity<OpenLmisResponse> getLocales(HttpServletRequest request) { messageService.setCurrentLocale(RequestContextUtils.getLocale(request)); return response("locales", messageService.getLocales()); }  @RequestMapping(value = "", method = GET) String homeDefault(); @RequestMapping(value = "/locales", method = GET) ResponseEntity<OpenLmisResponse> getLocales(HttpServletRequest request); @RequestMapping(value = "/changeLocale", method = PUT, headers = ACCEPT_JSON) void changeLocale(HttpServletRequest request);  }