@Test public void shouldCreateBody() { String result = new HtmlDocumentBuilder().build(null); assertThat(result, containsString("<body>")); assertThat(result, containsString("</body>")); }
public String build(String body) { StringBuilder result = new StringBuilder(); result.append("<!DOCTYPE html>\n"); result.append("<html>\n"); result.append("<head>\n"); if (!Strings.isNullOrEmpty(title)) { result.append("<title>").append(title.trim()).append("</title>\n"); } for (String stylesheet : stylesheets) { result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(stylesheet); result.append("\">\n"); } for (String headerInjection : headerInjections) { result.append(headerInjection); result.append("\n"); } result.append("</head>\n"); result.append("<body>\n"); if (!Strings.isNullOrEmpty(body)) { result.append(body).append("\n"); } result.append("</body>\n"); result.append("</html>\n"); return result.toString(); }
HtmlDocumentBuilder { public String build(String body) { StringBuilder result = new StringBuilder(); result.append("<!DOCTYPE html>\n"); result.append("<html>\n"); result.append("<head>\n"); if (!Strings.isNullOrEmpty(title)) { result.append("<title>").append(title.trim()).append("</title>\n"); } for (String stylesheet : stylesheets) { result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(stylesheet); result.append("\">\n"); } for (String headerInjection : headerInjections) { result.append(headerInjection); result.append("\n"); } result.append("</head>\n"); result.append("<body>\n"); if (!Strings.isNullOrEmpty(body)) { result.append(body).append("\n"); } result.append("</body>\n"); result.append("</html>\n"); return result.toString(); } }
HtmlDocumentBuilder { public String build(String body) { StringBuilder result = new StringBuilder(); result.append("<!DOCTYPE html>\n"); result.append("<html>\n"); result.append("<head>\n"); if (!Strings.isNullOrEmpty(title)) { result.append("<title>").append(title.trim()).append("</title>\n"); } for (String stylesheet : stylesheets) { result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(stylesheet); result.append("\">\n"); } for (String headerInjection : headerInjections) { result.append(headerInjection); result.append("\n"); } result.append("</head>\n"); result.append("<body>\n"); if (!Strings.isNullOrEmpty(body)) { result.append(body).append("\n"); } result.append("</body>\n"); result.append("</html>\n"); return result.toString(); }  }
HtmlDocumentBuilder { public String build(String body) { StringBuilder result = new StringBuilder(); result.append("<!DOCTYPE html>\n"); result.append("<html>\n"); result.append("<head>\n"); if (!Strings.isNullOrEmpty(title)) { result.append("<title>").append(title.trim()).append("</title>\n"); } for (String stylesheet : stylesheets) { result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(stylesheet); result.append("\">\n"); } for (String headerInjection : headerInjections) { result.append(headerInjection); result.append("\n"); } result.append("</head>\n"); result.append("<body>\n"); if (!Strings.isNullOrEmpty(body)) { result.append(body).append("\n"); } result.append("</body>\n"); result.append("</html>\n"); return result.toString(); }  HtmlDocumentBuilder addStylesheet(String url); HtmlDocumentBuilder withTitle(String title); HtmlDocumentBuilder addHeaderInjection(String element); String build(String body); }
HtmlDocumentBuilder { public String build(String body) { StringBuilder result = new StringBuilder(); result.append("<!DOCTYPE html>\n"); result.append("<html>\n"); result.append("<head>\n"); if (!Strings.isNullOrEmpty(title)) { result.append("<title>").append(title.trim()).append("</title>\n"); } for (String stylesheet : stylesheets) { result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""); result.append(stylesheet); result.append("\">\n"); } for (String headerInjection : headerInjections) { result.append(headerInjection); result.append("\n"); } result.append("</head>\n"); result.append("<body>\n"); if (!Strings.isNullOrEmpty(body)) { result.append(body).append("\n"); } result.append("</body>\n"); result.append("</html>\n"); return result.toString(); }  HtmlDocumentBuilder addStylesheet(String url); HtmlDocumentBuilder withTitle(String title); HtmlDocumentBuilder addHeaderInjection(String element); String build(String body);  }