01: package fit;
02:
03: import junit.framework.TestCase;
04:
05: import java.io.StringWriter;
06: import java.io.PrintWriter;
07:
08: public class FileRunnerTest extends TestCase {
09: Parse tempParse;
10:
11: String simpleHtml = "<table>" + " <tr><td>fit.Fixture</td></tr>"
12: + "</table>";
13:
14: String wikiHtml = "<table><tr><td>extra formatting" + " <wiki>"
15: + " <table>"
16: + " <tr><td>fit.Fixture</td></tr>"
17: + " </table>" + " </wiki>" + "</td></tr></table>";
18:
19: public void testRunningFileWithWikiTag() {
20: testHtml(simpleHtml);
21: testHtml(wikiHtml);
22: }
23:
24: private void testHtml(String html) {
25: FileRunner runner = new FileRunner();
26: runner.fixture = new Fixture() {
27: public void doTables(Parse tables) {
28: tempParse = tables;
29: }
30: };
31: runner.input = html;
32: runner.output = new PrintWriter(new StringWriter());
33: runner.process();
34:
35: assertEquals("fit.Fixture", tempParse.leaf().text());
36: }
37: }
|