HtmlSpecificationItem implements Viewable { @Override public void render(final int level) { final String indentation = IndentationHelper.createIndentationPrefix(level); final SpecificationItemId id = this.item.getId(); renderStart(indentation, id); renderSummary(indentation, id); renderId(indentation, id); renderDescription(indentation); renderRationale(indentation); renderComment(indentation); renderNeeds(indentation); renderOrigin(indentation); renderLinks(indentation); renderEnd(indentation); } HtmlSpecificationItem(final PrintStream stream, final LinkedSpecificationItem item); @Override void render(final int level);  }
@Test void testRenderIncomingLinks() { final SpecificationItem item = SpecificationItem.builder() .id(ITEM_A_ID) .build(); final LinkedSpecificationItem linkedItem = new LinkedSpecificationItem(item); linkedItem.addLinkToItemWithStatus(this.itemMockB, LinkStatus.COVERED_SHALLOW); linkedItem.addLinkToItemWithStatus(this.itemMockC, LinkStatus.COVERED_UNWANTED); final Viewable view = this.factory.createSpecificationItem(linkedItem); view.render(0); assertOutputLines( "<section class=\"sitem\" id=\"dsn~name-a~1\">", " <details>", " <summary title=\"dsn~name-a~1\">" + CROSS_MARK + " <b>name-a</b><small>, rev. 1, dsn</small></summary>", " <p class=\"id\">" + ITEM_A_ID + "</p>", " <div class=\"in\">", " <h6>In: 2</h6>", " <ul>", " <li><a href=\"#" + ITEM_B_ID + "\">" + ITEM_B_ID + "</a></li>", " <li><a href=\"#" + ITEM_C_ID + "\">" + ITEM_C_ID + "</a> <em>(unwanted coverage)</em></li>", " </ul>", " </div>", " </details>", "</section>", ""); }
@Test void testRenderOutgoingLinks() { final SpecificationItem item = SpecificationItem.builder() .id(ITEM_A_ID) .build(); final LinkedSpecificationItem linkedItem = new LinkedSpecificationItem(item); linkedItem.addLinkToItemWithStatus(this.itemMockB, LinkStatus.COVERS); linkedItem.addLinkToItemWithStatus(this.itemMockC, LinkStatus.UNWANTED); final Viewable view = this.factory.createSpecificationItem(linkedItem); view.render(0); assertOutputLines( "<section class=\"sitem\" id=\"dsn~name-a~1\">", " <details>", " <summary title=\"dsn~name-a~1\">" + CROSS_MARK + " <b>name-a</b><small>, rev. 1, dsn</small></summary>", " <p class=\"id\">" + ITEM_A_ID + "</p>", " <div class=\"out\">", " <h6>Out: 2</h6>", " <ul>", " <li><a href=\"#" + ITEM_B_ID + "\">" + ITEM_B_ID + "</a></li>", " <li><a href=\"#" + ITEM_C_ID + "\">" + ITEM_C_ID + "</a> <em>(unwanted)</em></li>", " </ul>", " </div>", " </details>", "</section>", ""); }