01: // Copyright (c) 2003 Cunningham & Cunningham, Inc.
02: // Read license.txt in this directory.
03:
04: package fat;
05:
06: import java.text.ParseException;
07:
08: import junit.framework.TestCase;
09: import fit.Fixture;
10: import fit.Parse;
11:
12: public class FatTest extends TestCase {
13:
14: public FatTest(String name) {
15: super (name);
16: }
17:
18: public void testCopy() throws ParseException {
19: Parse in = new Parse("<table><tr><td>foo</td></tr></table>");
20: Parse out = Table.copy(in);
21: assertEquals("foo", out.at(0, 0, 0).body);
22: assertTrue("references shouldn't be equal", in != out);
23: assertTrue("deep references shouldn't be equal",
24: in.parts != out.parts);
25: }
26:
27: public void testTable() throws ParseException {
28: Parse in = new Parse(
29: "<table><tr><td>eg.Arithmetic</td></tr><tr><td>labels</td></tr></table>");
30: Fixture fixture = new Table();
31: fixture.doTable(in);
32: assertTrue("non-null global table", Table.table != null);
33: }
34:
35: public void testColor() throws ParseException {
36: Color fixture = new fat.Color();
37: Parse white = new Parse("td", "foo", null, null);
38: Parse red = Table.copy(white);
39: fixture.wrong(red);
40: Parse green = Table.copy(white);
41: fixture.right(green);
42: Parse gray = Table.copy(white);
43: fixture.ignore(gray);
44: Parse yellow = Table.copy(white);
45: fixture.exception(yellow, new Exception("big trouble"));
46:
47: assertEquals("white", fixture.color(white));
48: assertEquals("red", fixture.color(red));
49: assertEquals("green", fixture.color(green));
50: assertEquals("gray", fixture.color(gray));
51: assertEquals("yellow", fixture.color(yellow));
52: }
53:
54: // public void testAcceptanceTestsPass() throws IOException {
55: // testName = "index.html";
56: //
57: // FileRunner runner = new FileRunner();
58: // String outputFileName = "output/test/junit-" + testName;
59: // runner.args(new String[]{"../../spec/" + testName, outputFileName});
60: // runner.process();
61: // runner.output.close();
62: //
63: // assertEquals("should have no exceptions (" + outputFileName + ")", 0, runner.fixture.counts.exceptions);
64: // assertEquals("should have no wrong (" + outputFileName + ")", 0, runner.fixture.counts.wrong);
65: // assertEquals("should have no ignores (" + outputFileName + ")", 0, runner.fixture.counts.ignores);
66: // }
67: }
|