HtmlStream implements Closeable { public void open() throws IOException { this.writer.append("<html><body>"); } HtmlStream(Writer writer); void open(); @Override void close(); HtmlStream newLine(); HtmlStream newLines(int n); HtmlStream open(HtmlTag tag); HtmlStream open(HtmlTag tag, HtmlClass classNames); HtmlStream close(HtmlTag tag); HtmlStream write(HtmlTag tag); HtmlStream write(HtmlTag tag, String text); HtmlStream write(HtmlTag tag, String text, HtmlClass classNames); HtmlStream write(String text, HtmlClass classNames); HtmlStream write(char c); HtmlStream write(double d); HtmlStream write(int i); HtmlStream write(String txt); HtmlStream open(HtmlTable table); HtmlStream write(HtmlTableCell cell); HtmlStream write(HtmlTableHeader header); HtmlStream write(IHtmlElement obj); @Deprecated HtmlStream write(String text, HtmlStyle... styles); @Deprecated HtmlStream open(HtmlTag tag, String attrName, String attrValue); @Deprecated HtmlStream open(HtmlTag tag, CssStyle style); @Deprecated HtmlStream open(HtmlTag tag, CssStyle style, String attrName, String attrValue); @Deprecated HtmlStream open(HtmlTag tag, Map<String, String> attributes); @Deprecated HtmlStream write(HtmlTag tag, CssStyle style, String text); @Deprecated HtmlStream write(HtmlTableCell cell, String cellBg); final Writer writer; }
@Test public void testOpenTag() throws IOException { assertThat(of().open(DIV).writer.toString()).isEqualTo("<div>"); assertThat(of().open(DIV, NO_CLASS).writer.toString()).isEqualTo("<div>"); assertThat(of().open(DIV, HELLO_CLASS).writer.toString()).isEqualTo("<div class=\"hello\">"); }