### Question:
JUnitFormatter implements Formatter { public String getSummaryData(TestSummary summary) { StringBuffer sb = new StringBuffer(); int testCases = 1; int failureCount = summary.getFailures() == 0 ? 0 : (summary.getErrors() > 0 ? 0 : 1); sb.append("\n<testsuite errors=\"").append(summary.getErrors() > 0 ? 1 : 0).append( "\" failures=\"").append(failureCount).append( "\" name=\"").append( Utils.escapeQuotesForXML(summary.getSuiteName() + "." + summary.getScriptName().replace(".sah", ""))).append( "\" tests=\"").append(testCases).append( "\" time=\"").append(new Double(summary.getTimeTaken()) / 1000).append("\">\n") .append("<testcase classname=\"").append( Utils.escapeQuotesForXML(summary.getSuiteName() + "." + summary.getScriptName().replace(".sah", ""))).append( "\" name=\"").append( Utils.escapeQuotesForXML(summary.getScriptName())).append( "\" time=\"").append(new Double(summary.getTimeTaken()) / 1000).append("\">"); return sb.toString(); }  String getFileName(String scriptName); String getFooter(); String getSuiteLogFileName(); String getHeader(); String getResultData(List<TestResult> listResult); String getStartScript(); String getStopScript(); String getSummaryData(TestSummary summary); String getStringResult(final TestResult result); String getSummaryFooter(); String getSummaryHeader();  }### Answer:
@Test public void testGetSummaryDataForEmptyList() { String expected = "\n<testsuite errors=\"0\" failures=\"0\" name=\"null.test\" tests=\"1\" time=\"0.0\">\n<testcase classname=\"null.test\" name=\"test\" time=\"0.0\">"; TestSummary summary = new TestSummary(); summary.setScriptName("test"); assertEquals(expected, formatter.getSummaryData(summary)); }
@Test public void testGetSummaryDataForAllTypes() { String expected = "\n<testsuite errors=\"0\" failures=\"1\" name=\"null.test\" tests=\"1\" time=\"0.0\">\n<testcase classname=\"null.test\" name=\"test\" time=\"0.0\">"; assertEquals(expected, formatter.getSummaryData(ReportUtil .getTestSummary())); }