### Question:
Template { public Template resolveBy(Resolver resolver, DeclaringComponent currentComponent) { String replaced = content.replace("${this@templateName}", templateNameWithoutBrackets()); Matcher m = pattern.matcher(replaced); if (!m.find()) return withContent(replaced); StringBuffer result = new StringBuffer(); do { doResolve(m, result, resolver, currentComponent); } while (m.find()); m.appendTail(result); String content = result.toString(); return withContent(content); } Template(String templateName, File source, Pattern pattern); Template resolveBy(Resolver resolver, DeclaringComponent currentComponent); Template postProcessContent(TemplateContentPostProcessor postProcessor,
                                       String templateType, TypedProperties properties); void copyTo(File destinationFile); static boolean isValidPlaceholder(String value);  }### Answer:
@Test void testMultiLinePlaceholderInTemplate() { String result = new Template("name", classpathFile("templates/templateWithMultiLines.yaml"), templatePattern) .resolveBy(resolver(), new DeclaringComponentImpl("app", "mergeLists", "some")) .getContent(); assertEquals("key1:\n" + " key2:\n" + " key3:\n" + " - name: n1\n" + " v: v2\n" + " - v1\n" + " - v2\n" + " - v3\n" + " - v4\n" + " - v5\n" + " \n" + "\n" + "\n" + "key10: mergeLists", toUnixPathSeparator(result)); }
@Test void testEnvProperties() { Entry<String, String> entry = System.getenv().entrySet().iterator().next(); String result = new Template("name", source, templatePattern, "${env@" + entry.getKey() + "}"). resolveBy(resolver(), root).getContent(); UnaryOperator<String> escape = v -> v.replaceAll("\\\\+", "/"); assertEquals(escape.apply(entry.getValue()), escape.apply(result)); }