01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.runner;
04:
05: import fit.Counts;
06: import java.util.*;
07: import java.io.*;
08:
09: public class MockResultFormatter implements ResultFormatter {
10: public List results = new LinkedList();
11:
12: public Counts finalCounts;
13:
14: public StringBuffer output = new StringBuffer("Mock Results:\n");
15:
16: public void acceptResult(PageResult result) throws Exception {
17: results.add(result);
18: output.append(result.toString());
19: }
20:
21: public void acceptFinalCount(Counts count) throws Exception {
22: finalCounts = count;
23: output.append("Finals Counts: " + count.toString());
24: }
25:
26: public int getByteCount() {
27: return output.toString().getBytes().length;
28: }
29:
30: public InputStream getResultStream() throws Exception {
31: return new ByteArrayInputStream(output.toString().getBytes());
32: }
33:
34: }
|