AsciidoctorMarkup extends AbstractMarkup { @Override public String convertAsHtml(String markupString) throws IllegalArgumentException { if (markupString == null) throw new IllegalArgumentException("Can not convert " + getName() + " to HTML : the String is null"); final AttributesBuilder attributes = AttributesBuilder.attributes() .sectionNumbers(false) .noFooter(true) .tableOfContents(false) .showTitle(false) .skipFrontMatter(true) .attribute("sectids!", ""); final OptionsBuilder options = OptionsBuilder.options() .compact(true) .backend("html5") .attributes(attributes); return this.asciidoctor.convert(markupString, options).trim(); } AsciidoctorMarkup(); @Override String convertAsHtml(String markupString);  }
@Test public void generateWithNull() { assertThrows(IllegalArgumentException.class, () -> markup.convertAsHtml(null)); }
@Test public void generateH1() { final String result = markup.convertAsHtml("= A title"); assertEquals("<h1>A title</h1>", result); }
@Test public void generateH2() { final String result = markup.convertAsHtml("== A title"); System.out.println(result); assertEquals("<h2>A title</h2>", result); }
@Test public void generateInlineCode() { final String result = markup.convertAsHtml("<code>public class Java { }</code>"); assertEquals("<code>public class Java { }</code>", result); }
@Test public void generateCodeBloc() { final String result = markup.convertAsHtml("[source,java]\n----\nfinal String s;\n----\n"); System.out.println(result); assertEquals("<pre><code>final String s;</code></pre>", result); }
@Test public void generateStrong() { final String result = markup.convertAsHtml("*Strong text*"); assertEquals("<strong>Strong text</strong>", result); }
@Test public void generateUnorderedList() { final String result = markup.convertAsHtml("<ul><li>One</li><li>Two</li></ul>"); assertEquals("<ul><li>One</li><li>Two</li></ul>", result); }