@Test public void replaceFunctionalityIdPlaceholders_ShouldReplaceIds_WhenSomeOfThemArePresent() { Map<String, Long> functionalityIds = new HashMap<>(); functionalityIds.put("A", Long.valueOf(21)); functionalityIds.put("B", Long.valueOf(22)); functionalityIds.put("C", Long.valueOf(23)); String fileContent = "Functionality {{F-A}}, {{F-B}}, {{F-A}} & {{F-Z}}: Some Title"; final String replacedContent = cut.replaceFunctionalityIdPlaceholders(functionalityIds, fileContent); assertThat(replacedContent).isEqualTo("Functionality 21, 22, 21 & {{F-Z}}: Some Title"); }
String replaceFunctionalityIdPlaceholders(Map<String, Long> functionalityIds, String fileContent) { String replaced = fileContent; for (Map.Entry<String, Long> entry : functionalityIds.entrySet()) { replaced = replaced.replace("{{F-" + entry.getKey() + "}}", entry.getValue().toString()); } return replaced; }
DemoLoaderService { String replaceFunctionalityIdPlaceholders(Map<String, Long> functionalityIds, String fileContent) { String replaced = fileContent; for (Map.Entry<String, Long> entry : functionalityIds.entrySet()) { replaced = replaced.replace("{{F-" + entry.getKey() + "}}", entry.getValue().toString()); } return replaced; } }
DemoLoaderService { String replaceFunctionalityIdPlaceholders(Map<String, Long> functionalityIds, String fileContent) { String replaced = fileContent; for (Map.Entry<String, Long> entry : functionalityIds.entrySet()) { replaced = replaced.replace("{{F-" + entry.getKey() + "}}", entry.getValue().toString()); } return replaced; }  }
DemoLoaderService { String replaceFunctionalityIdPlaceholders(Map<String, Long> functionalityIds, String fileContent) { String replaced = fileContent; for (Map.Entry<String, Long> entry : functionalityIds.entrySet()) { replaced = replaced.replace("{{F-" + entry.getKey() + "}}", entry.getValue().toString()); } return replaced; }   }
DemoLoaderService { String replaceFunctionalityIdPlaceholders(Map<String, Long> functionalityIds, String fileContent) { String replaced = fileContent; for (Map.Entry<String, Long> entry : functionalityIds.entrySet()) { replaced = replaced.replace("{{F-" + entry.getKey() + "}}", entry.getValue().toString()); } return replaced; }    }