@Test public void shouldReturnLocalesCodes() throws Exception { MessageService service = new MessageService(messageSource, "en, pt, fr"); Set<String> locales = service.getLocales(); assertThat(locales.size(), is(3)); assertTrue(locales.contains("en")); assertTrue(locales.contains("pt")); assertTrue(locales.contains("fr")); }
public Set<String> getLocales() { Set<String> localeSet = new HashSet<>(); String[] localeCodes = locales.split(","); for (String locale : localeCodes) { localeSet.add(locale.trim()); } return localeSet; }
MessageService { public Set<String> getLocales() { Set<String> localeSet = new HashSet<>(); String[] localeCodes = locales.split(","); for (String locale : localeCodes) { localeSet.add(locale.trim()); } return localeSet; } }
MessageService { public Set<String> getLocales() { Set<String> localeSet = new HashSet<>(); String[] localeCodes = locales.split(","); for (String locale : localeCodes) { localeSet.add(locale.trim()); } return localeSet; } @Autowired  MessageService(ExposedMessageSource messageSource, @Value("${locales.supported}") String locales); }
MessageService { public Set<String> getLocales() { Set<String> localeSet = new HashSet<>(); String[] localeCodes = locales.split(","); for (String locale : localeCodes) { localeSet.add(locale.trim()); } return localeSet; } @Autowired  MessageService(ExposedMessageSource messageSource, @Value("${locales.supported}") String locales); @Scope(SCOPE_REQUEST) static MessageService getRequestInstance(); String message(String key); String message(OpenLmisMessage openLmisMessage); @SuppressWarnings("non-varargs") String message(String key, Object... args); Set<String> getLocales(); Map<String, String> allMessages(); Map<String, String> allMessages(Locale locale); }
MessageService { public Set<String> getLocales() { Set<String> localeSet = new HashSet<>(); String[] localeCodes = locales.split(","); for (String locale : localeCodes) { localeSet.add(locale.trim()); } return localeSet; } @Autowired  MessageService(ExposedMessageSource messageSource, @Value("${locales.supported}") String locales); @Scope(SCOPE_REQUEST) static MessageService getRequestInstance(); String message(String key); String message(OpenLmisMessage openLmisMessage); @SuppressWarnings("non-varargs") String message(String key, Object... args); Set<String> getLocales(); Map<String, String> allMessages(); Map<String, String> allMessages(Locale locale);  }