### Question:
Template { public String process(String str) { StringBuilder sb = new StringBuilder(); for (String line : str.split("\r?\n")) { if (line.startsWith("#include ")) { String resource = line.substring(9); String resourceStr = resourceLoader.apply(resource); sb.append(process(resourceStr)); } else { sb.append(line).append('\n'); } } return sb.toString(); } Template(Function<String, String> resourceLoader); String process(String str);  }### Answer:
@Test public void testProcess() { Function<String, String> func = (String resource) -> { switch (resource) { case "file2": return FILE2; default: throw new RuntimeException("unknown resource"); } }; String out = new Template(func).process(FILE1); assertEquals(RESULT, out); }