@Test
  public void testResultsHtml() throws Exception {
    TestSystem fitMock = mock(TestSystem.class);
    when(fitMock.getName()).thenReturn("Fit:laughing.fit");
    TestSystem slimMock = mock(TestSystem.class);
    when(slimMock.getName()).thenReturn("Slim:very.slim");

    formatter.testSystemStarted(fitMock);
    formatter.announceNumberTestsToRun(2);
    formatter.announceStartNewTest("RelativeName", "FullName");
    formatter.testOutputChunk("starting");
    formatter.testOutputChunk(" output");
    formatter.processTestResults("RelativeName", new TestSummary(1, 0, 0, 0));
    formatter.testSystemStarted(slimMock);
    formatter.announceStartNewTest("NewRelativeName", "NewFullName");
    formatter.testOutputChunk("second");
    formatter.testOutputChunk(" test");
    formatter.processTestResults("NewRelativeName", new TestSummary(0, 1, 0, 0));
    formatter.finishWritingOutput();

    String results = pageBuffer.toString();

    assertSubString("<h2>Test System: Slim:very.slim</h2>", results);

    assertSubString("<div class=\"test_output_name\">", results);
    assertSubString(
        "<a href=\"FullName\" id=\"RelativeName1\" class=\"test_name\">RelativeName</a>", results);
    assertSubString("<div class=\"alternating_block\">starting output</div>", results);

    assertSubString(
        "<a href=\"NewFullName\" id=\"NewRelativeName2\" class=\"test_name\">NewRelativeName</a>",
        results);
    assertSubString("<div class=\"alternating_block\">second test</div>", results);
  }
  @Test
  public void testTestingProgressIndicator() throws Exception {
    TestSystem fitMock = mock(TestSystem.class);
    when(fitMock.getName()).thenReturn("Fit:laughing.fit");

    formatter.testSystemStarted(fitMock);
    formatter.announceNumberTestsToRun(20);
    formatter.announceStartNewTest("RelativeName", "FullName");

    assertSubString(
        "<script>document.getElementById(\"test-summary\").innerHTML ="
            + " \"<div id=\\\"progressBar\\\" class=\\\"pass\\\" style=\\\"width:0.0%\\\">",
        pageBuffer.toString());
    assertSubString("Running&nbsp;tests&nbsp;...&nbsp;(1/20)", pageBuffer.toString());
    pageBuffer.setLength(0);

    formatter.processTestResults("RelativeName", new TestSummary(1, 0, 0, 0));
    formatter.announceStartNewTest("RelativeName", "FullName");

    assertSubString(
        "<script>document.getElementById(\"test-summary\").innerHTML ="
            + " \"<div id=\\\"progressBar\\\" class=\\\"pass\\\" style=\\\"width:5.0%\\\">",
        pageBuffer.toString());
    assertSubString("(2/20)", pageBuffer.toString());
    pageBuffer.setLength(0);

    formatter.processTestResults("RelativeName", new TestSummary(1, 0, 0, 0));
    formatter.announceStartNewTest("RelativeName", "FullName");

    assertSubString(
        "<script>document.getElementById(\"test-summary\").innerHTML ="
            + " \"<div id=\\\"progressBar\\\" class=\\\"pass\\\" style=\\\"width:10.0%\\\">",
        pageBuffer.toString());
    assertSubString("(3/20)", pageBuffer.toString());
  }
 @Override
 public void testSystemStopped(TestSystem testSystem, Throwable cause) {
   notifyOfTestSystemException(testSystem.getName(), cause);
 }