HtmlGenerator { public void generate() throws IOException { ApiModel apiModel = new ApiModelBuilder().buildApiModel(config.getSourceFile()); TemplateEngine engine = new TemplateEngine(); engine.setTemplateDir(config.getTemplateDir()); String result = engine.renderTemplate("api", apiModel); File targetDir = new File(config.getTargetDir()); createDirectoryIfNeeded(targetDir); Files.write(targetDir.toPath() .resolve("index.html"), result.getBytes(StandardCharsets.UTF_8)); writeWebResources(targetDir); } HtmlGenerator(HtmlConfiguration config); void generate();  }
@Test public void shouldRenderApi() throws IOException { HtmlConfiguration config = new HtmlConfiguration(); config.setSourceFile("src/test/resources/raml/simpleobject.raml"); config.setTargetDir("target/html/simpleobject"); HtmlGenerator generator = new HtmlGenerator(config); generator.generate(); verifyTargetDir(config); }
@Test public void shouldRenderRegistryApi() throws IOException { HtmlConfiguration config = new HtmlConfiguration(); config.setSourceFile("../ramler-java/src/test/resources/raml/registry.raml"); config.setTargetDir("target/html/registry"); HtmlGenerator generator = new HtmlGenerator(config); generator.generate(); verifyTargetDir(config); }