private void executionDataTable(final HTMLElement body) throws IOException { final HTMLElement table = body.table(Styles.COVERAGETABLE); { final HTMLElement tr = table.thead().tr(); tr.td().text("Class"); tr.td().text("Id"); } final HTMLElement tbody = table.tbody(); final ILanguageNames names = context.getLanguageNames(); for (final ExecutionData e : executionData) { final HTMLElement tr = tbody.tr(); final String link = index.getLinkToClass(e.getId()); final String qualifiedName = names.getQualifiedClassName(e.getName()); if (link == null) { tr.td().span(Styles.EL_CLASS).text(qualifiedName); } else { tr.td().a(link, Styles.EL_CLASS).text(qualifiedName); } final String id = String.format("%016x", Long.valueOf(e.getId())); tr.td().code().text(id); } }
@Test public void testExecutionDataContent() throws Exception { final Collection<ExecutionData> data = new ArrayList<ExecutionData>(); data.add(new ExecutionData(0x1000, "ClassB", new boolean[0])); data.add(new ExecutionData(0x1001, "ClassC", new boolean[0])); data.add(new ExecutionData(0x1002, "ClassA", new boolean[0])); index.addClass( new ReportPage(null, rootFolder, context) { public String getLinkLabel() { return "Foo"; } @Override protected String getFileName() { return "Foo.html"; } public String getLinkStyle() { return "sample"; } @Override protected void content(HTMLElement body) throws IOException {} }, 0x1002); final SessionsPage page = new SessionsPage(noSessions, data, index, null, rootFolder, context); page.render(); final Document doc = support.parse(output.getFile(".sessions.html")); assertEquals( "el_class", support.findStr(doc, "/html/body/table[1]/tbody/tr[1]/td[1]/a/@class")); assertEquals("Foo.html", support.findStr(doc, "/html/body/table[1]/tbody/tr[1]/td[1]/a/@href")); assertEquals("ClassA", support.findStr(doc, "/html/body/table[1]/tbody/tr[1]/td[1]/a")); assertEquals( "0000000000001002", support.findStr(doc, "/html/body/table[1]/tbody/tr[1]/td[2]/code")); assertEquals("ClassB", support.findStr(doc, "/html/body/table[1]/tbody/tr[2]/td[1]")); assertEquals("ClassC", support.findStr(doc, "/html/body/table[1]/tbody/tr[3]/td[1]")); }