@Test
public void shouldReplaceText() {

    Map<String, String> map = new LinkedHashMap<String, String>();
    map.put("original", "custom");
    map.put("Clients", "People");
    map.put("Client", "Person");
    map.put("Admin", "Administrator");
    when(customizedTextDao.getCustomizedText()).thenReturn(map);
    String newString = customizedTextServiceFacadeWebTier.replaceSubstitutions("" + "This is the original message");
    assertThat(newString, is("This is the custom message"));
    // this illustrates a limitiation of the current approach, "Admin" is replaced in the first part of
    // "Administrators". But we can't do something like only replace whole words since this breaks
    // i18n for locales like Chinese
    newString = customizedTextServiceFacadeWebTier
            .replaceSubstitutions("The Admin function is performed by admins, Admins and Administrators");
    assertThat(newString,
            is("The Administrator function is performed by admins, Administrators and Administratoristrators"));
    newString = customizedTextServiceFacadeWebTier.replaceSubstitutions("" + "Many Clients have a Client");
    assertThat(newString, is("Many People have a Person"));
}