}
@Test
public void processTestResultsShouldBuildUpCurrentResultAndFinalSummary() throws Exception {
FitNesseContext context = mock(FitNesseContext.class);
WikiTestPage page = new WikiTestPage(new WikiPageDummy("name", "content", null), null);
page.getData().setAttribute(PageData.PropertySUITES, "tag1");
WriterFactory writerFactory = mock(WriterFactory.class);
final TestResult testResult = new TestResult();
TestXmlFormatter formatter = new TestXmlFormatter(context , page.getSourcePage(), writerFactory) {
@Override
protected TestResult newTestResult() {
return testResult;
}
};
final long startTime = clock.currentClockTimeInMillis();
formatter.testOutputChunk("outputChunk");
formatter.testStarted(page);
clock.elapse(27);
TestSummary summary = new TestSummary(9,8,7,6);
formatter.testComplete(page, summary);
assertThat(formatter.testResponse.getFinalCounts(), equalTo(new TestSummary(0,1,0,0)));
assertThat(formatter.testResponse.getResults().size(), is(1));
assertThat(formatter.testResponse.getResults().get(0), is(testResult));
assertThat(testResult.startTime, is(startTime));
assertThat(testResult.content, is("outputChunk"));
assertThat(testResult.right, is("9"));
assertThat(testResult.wrong, is("8"));
assertThat(testResult.ignores, is("7"));
assertThat(testResult.exceptions, is("6"));
assertThat(testResult.runTimeInMillis, is("27"));
assertThat(testResult.relativePageName, is(page.getName()));
assertThat(testResult.tags, is("tag1"));
}