WelcomePageGenerator { public void buildWelcomeHtmlFile(Path moduleResources, Path outputFile) throws IOException { StringBuilder welcomePage = new StringBuilder(); welcomePage.append(before); File[] children = moduleResources.toFile().listFiles(); if (children == null) { throw new CarnotzetDefinitionException( "Resources folder does not exist or is not a directory : [" + moduleResources + "]"); } Arrays.sort(children); for (File child : children) { appendWelcomeFrom(child, welcomePage); } welcomePage.append(after); String welcomePageStr = welcomePage.toString(); for (WelcomePagePostProcessor postProcessor : postProcessors) { welcomePageStr = postProcessor.process(welcomePageStr); } Files.write(welcomePageStr, outputFile.toFile(), Charsets.UTF_8); } WelcomePageGenerator();  WelcomePageGenerator(List<WelcomePagePostProcessor> postProcessors); void buildWelcomeHtmlFile(Path moduleResources, Path outputFile);  }
@Test public void generate_welcome_page() throws IOException { WelcomePageGenerator generator = new WelcomePageGenerator(); URL url = Thread.currentThread().getContextClassLoader().getResource("example_welcome"); File example = new File(url.getPath()); Path output = temp.newFolder().toPath().resolve("welcome.html"); generator.buildWelcomeHtmlFile(example.toPath().resolve("expanded-jars"), output); Assert.assertEquals("The files differ!", FileUtils.readFileToString(example.toPath().resolve("expected/welcome.html").toFile(), "utf-8"), FileUtils.readFileToString(output.toFile(), "utf-8")); }