@Test public void test_getRawContent_replaces_back_alternating_parts() throws ContentSyntaxErrorException { Map<String, List<String>> altData = new HashMap<String, List<String>>(); List<String> value = new Vector<String>(); value.add("real-value"); altData.put("description", value); final String headerStr = "/* constant \n" + " * <description>%description%0%</description>*/"; FileHeader header = new FileHeader(headerStr, '%') {}; assertEquals( "/* constant \n * <description>real-value</description>*/", header.getRawContent(altData)); }
@Test public void tets_getRawContent_replaces_two_block_with_same_id_correctly() throws ContentSyntaxErrorException { Map<String, List<String>> altData = new HashMap<String, List<String>>(); List<String> value = new Vector<String>(); value.add("real-value"); value.add("real-value2"); altData.put("description", value); final String headerStr = "/* constant \n" + " * <description>%description%1%</description> \n" + " * <description>%description%0%</description> */"; FileHeader header = new FileHeader(headerStr, '%') {}; assertEquals( "/* constant \n" + " * <description>real-value2</description> \n" + " * <description>real-value</description> */", header.getRawContent(altData)); }