TypeLinkRenderer extends LinkRenderer { @Override public Rendering render(WikiLinkNode node) { String source = node.getText(); String url = source; String text = source; int pos; if ((pos = source.indexOf('|')) >= 0) { url = source.substring(0, pos); text = source.substring(pos + 1); } return new Rendering("#/types/" + url, text); }  @Override Rendering render(WikiLinkNode node);  }
@Test void renderWithDefaultText() { LinkRenderer.Rendering rendering = renderer.render(new WikiLinkNode("io.protostuff.Test")); assertEquals("#/types/io.protostuff.Test", rendering.href); assertEquals("io.protostuff.Test", rendering.text); }
@Test void renderWithCustomText() { LinkRenderer.Rendering rendering = renderer.render(new WikiLinkNode("io.protostuff.Test|Test")); assertEquals("#/types/io.protostuff.Test", rendering.href); assertEquals("Test", rendering.text); }