@Test public void docsWithRelativeLinkShouldUseRelationTypeBaseUriAsPrefix() { final Documentation documentation = docsGenerator() .documentationFrom( create("http://example.org/rel/foo"), ControllerWithRelativeLink.class); assertEquals(documentation.getLink(), create("http://example.org/foo/bar.html")); }
@Test public void docsWithAbsoluteLinkShouldKeepLink() { final Documentation documentation = docsGenerator() .documentationFrom( create("http://example.org/rel/foo"), ControllerWithAbsoluteLink.class); assertEquals(documentation.getLink(), create("http://example.org/foo/bar.html")); }
@Test public void shouldNotFailToParseDocWithUnresolvableMarkdown() { final Documentation documentation = docsGenerator() .documentationFrom( create("http://example.org/rel/foo"), ControllerWithUnresolvableMarkdown.class); assertEquals(documentation.getDescription(), emptyList()); }
@Test public void docsGeneratorWithRelativeRootShouldWorkToo() { final DocsGenerator docsGenerator = new DocsGenerator(create("http://example.org"), "docs/*"); final Documentation documentation = docsGenerator.documentationFrom( create("http://example.org/rel/foo"), ControllerWithMinimalMarkdownInclude.class); assertEquals(documentation.getDescription(), emptyList()); assertEquals(documentation.getDetailedDescription(), "<h1>Hello World!</h1>"); }
@Test public void markdownIncludeShouldContainRenderedMarkdown() { final Documentation documentation = docsGenerator() .documentationFrom( create("http://example.org/rel/foo"), ControllerWithMinimalMarkdownInclude.class); assertEquals(documentation.getDescription(), emptyList()); assertEquals(documentation.getDetailedDescription(), "<h1>Hello World!</h1>"); }
@Test public void markdownIncludeWithValuesShouldContainBothDescriptions() { final Documentation documentation = docsGenerator() .documentationFrom( create("http://example.org/rel/foo"), ControllerWithMarkdownInclude.class); assertEquals(documentation.getDescription(), asList("foo", "bar")); assertEquals(documentation.getDetailedDescription(), "<h1>Hello World!</h1>"); }
@Test public void valuesShouldBeParsedAsDescription() { final Documentation documentation = docsGenerator() .documentationFrom( create("http://example.org/rel/foo"), ControllerWithAbsoluteLink.class); assertTrue(documentation.hasDescription()); assertEquals(documentation.getDescription(), asList("foo", "bar")); }