### Question:
HtmlFormatter implements Formatter { public String getSummaryData(TestSummary summary) { StringBuffer sb = new StringBuffer(); int successRate = summary.getSteps() != 0 ? ((summary.getSteps() - (summary.getFailures() + summary.getErrors())) * 100) / summary.getSteps() : 100; sb.append("<tr class=\""); sb.append(summary.hasFailed() ? ResultType.FAILURE.getName() : ResultType.SUCCESS.getName()); sb.append("\"><td>"); if (summary.addLink()) { sb.append("<a class=\"SCRIPT\" href=\"").append(getFileName(summary.getLogFileName())).append("\">").append(summary.getScriptName()).append( "</a>"); } else { sb.append(summary.getScriptName()); } sb.append("</td><td>").append(summary.getSteps()) .append("</td><td>").append(summary.getFailures()) .append("</td><td>").append(summary.getErrors()) .append("</td><td>").append(successRate) .append("%</td><td>").append(summary.getTimeTaken()) .append("</td></tr>"); return sb.toString(); }  String getFileName(String scriptName); String getResultData(List<TestResult> listResult); String getHeader(); String getStringResult(final TestResult result); String getSummaryHeader(); String getSummaryData(TestSummary summary); String getSummaryFooter(); String getFooter(); String getSuiteLogFileName(); String getStartScript(); String getStopScript();  }### Answer:
@Test public void testGetSummaryDataForEmptyList() { TestSummary summary = new TestSummary(); summary.setScriptName("test"); assertEquals(expectedSummaryForEmptyList, formatter .getSummaryData(summary)); }
@Test public void testGetSummaryDataForAllTypesWithoutLink() { assertEquals(expectedSummaryForAllTypes, formatter .getSummaryData(ReportUtil.getTestSummary())); }
@Test public void testGetSummaryDataForAllTypesWithLink() { String expected = expectedSummaryForAllTypes.replaceFirst("test", "<a class=\"SCRIPT\" href=\"test.htm\">test</a>"); TestSummary summary = ReportUtil.getTestSummary(); summary.setLogFileName("test"); summary.setAddLink(true); assertEquals(expected, formatter .getSummaryData(summary)); }