HtmlTableOfContents implements Viewable { @Override public void render(final int level) { boolean first = true; for (final Viewable view : this.from.getChildren()) { renderTableOfContentsItem(view, first); first = false; } } HtmlTableOfContents(final PrintStream outputStream, final ViewableContainer from); @Override void render(final int level);  }
@Test void testRender() { final Viewable sectionA = this.factory.createSection("a", "section a"); final Viewable sectionB = this.factory.createSection("b", "section b"); final Viewable unreferenceableSection = this.factory.createSection(null, null); final ViewableContainer container = this.factory.createView("foo", "bar"); container.add(sectionA); container.add(sectionB); container.add(unreferenceableSection); final Viewable toc = this.factory.createTableOfContents(container); toc.render(1); assertOutputLines(" | <a href=\"#a\">section a</a> &middot; <a href=\"#b\">section b</a>"); }