@Test void testPopulate() { when(enPlusNl.getMessageID()).thenReturn("EN_PLUS_NL"); doReturn("updated in database").when(enPlusNl).getString(en); doReturn("").when(enPlusNl).getString(nl); when(nlOnly.getMessageID()).thenReturn("NL_ONLY"); doReturn("alleen Nederlands").when(nlOnly).getString(nl); when(localizationService.getExistingMessages( "test", ImmutableSet.of("EN_PLUS_NL", "EN_ONLY", "NL_ONLY", "BIOBANK_UTF8"))) .thenReturn(Stream.of(enPlusNl, nlOnly)); doReturn(enOnly).when(l10nStringFactory).create("EN_ONLY"); when(enOnly.setMessageID("EN_ONLY")).thenReturn(enOnly); when(enOnly.getMessageID()).thenReturn("EN_ONLY"); doReturn(biobankUTF8).when(l10nStringFactory).create("BIOBANK_UTF8"); when(biobankUTF8.setMessageID("BIOBANK_UTF8")).thenReturn(biobankUTF8); when(biobankUTF8.getMessageID()).thenReturn("BIOBANK_UTF8"); localizationPopulator.populateLocalizationStrings(allPropertiesMessageSource); verify(enPlusNl).set("nl", "Engels plus Nederlands"); verify(enOnly).setNamespace("test"); verify(enOnly).set("en", "English only"); verify(biobankUTF8).setNamespace("test"); verify(biobankUTF8).set("en", "Biøbånk\uD83D\uDC00"); verify(biobankUTF8).set("nl", "\uD83D\uDC00\uD83C\uDDF3\uD83C\uDDF1"); verify(localizationService).store(updateCaptor.capture(), addCaptor.capture()); assertEquals(of(enPlusNl, nlOnly), newArrayList(updateCaptor.getValue())); assertEquals(of(enOnly, biobankUTF8), newArrayList(addCaptor.getValue())); }
@Transactional public void populateLocalizationStrings(AllPropertiesMessageSource source) { source .getAllMessageIds() .asMap() .forEach( (namespace, messageIds) -> updateNamespace(source, namespace, ImmutableSet.copyOf(messageIds))); }
LocalizationPopulator { @Transactional public void populateLocalizationStrings(AllPropertiesMessageSource source) { source .getAllMessageIds() .asMap() .forEach( (namespace, messageIds) -> updateNamespace(source, namespace, ImmutableSet.copyOf(messageIds))); } }
LocalizationPopulator { @Transactional public void populateLocalizationStrings(AllPropertiesMessageSource source) { source .getAllMessageIds() .asMap() .forEach( (namespace, messageIds) -> updateNamespace(source, namespace, ImmutableSet.copyOf(messageIds))); } LocalizationPopulator(
      LocalizationService localizationService, L10nStringFactory l10nStringFactory); }
LocalizationPopulator { @Transactional public void populateLocalizationStrings(AllPropertiesMessageSource source) { source .getAllMessageIds() .asMap() .forEach( (namespace, messageIds) -> updateNamespace(source, namespace, ImmutableSet.copyOf(messageIds))); } LocalizationPopulator(
      LocalizationService localizationService, L10nStringFactory l10nStringFactory); @Transactional void populateLocalizationStrings(AllPropertiesMessageSource source); }
LocalizationPopulator { @Transactional public void populateLocalizationStrings(AllPropertiesMessageSource source) { source .getAllMessageIds() .asMap() .forEach( (namespace, messageIds) -> updateNamespace(source, namespace, ImmutableSet.copyOf(messageIds))); } LocalizationPopulator(
      LocalizationService localizationService, L10nStringFactory l10nStringFactory); @Transactional void populateLocalizationStrings(AllPropertiesMessageSource source);  }