### Question:
JUnitFormatter implements Formatter { public String getStringResult(final TestResult result) { if (!(ResultType.FAILURE.equals(result.type) || ResultType.ERROR.equals(result.type))) return ""; StringBuffer sb = new StringBuffer(); if (ResultType.FAILURE.equals(result.type) || ResultType.ERROR.equals(result.type)) { String tag = ResultType.FAILURE.equals(result.type) ? "failure" : "error"; sb.append("\n<" + tag + " message=\"Assertion Failed\">"); if (!Utils.isBlankOrNull(result.failureMsg)) { sb.append("<![CDATA[").append(result.failureMsg).append("]]>"); } sb.append("</" + tag + ">\n"); } 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 testGetStringResultForSuccessResult() { String expected = ""; assertEquals(expected, formatter.getStringResult(ReportUtil .getSuccessResult())); }
@Test public void testGetStringResultForFailureResultWithoutDebugInfo() { String expected = "\n<failure message=\"Assertion Failed\"><![CDATA[Assertion Failed.]]></failure>\n"; assertEquals(expected, formatter.getStringResult(ReportUtil .getFailureResultWithoutDebugInfo())); }
@Test public void testGetStringResultForFailureResultWithDebugInfo() { String expected = "\n<failure message=\"Assertion Failed\"><![CDATA[Assertion Failed. Expected:[2] Actual:[1]]]></failure>\n"; assertEquals(expected, formatter.getStringResult(ReportUtil .getFailureResultWithDebugInfo())); }