1 package org.apache.texen;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23
24 import org.apache.texen.test.Log;
25 import org.apache.texen.test.TestUtil;
26
27 import junit.framework.TestCase;
28 import junit.framework.TestSuite;
29
30
31
32
33
34
35
36
37
38
39 public class TexenTestCase extends TestCase
40 {
41 public static final String TEST_DIR_KEY = "test.compare.dir";
42 public static final String RESULTS_DIR_KEY = "test.results.dir";
43
44 private String resultsDir;
45 private String compareDir;
46
47
48
49
50
51 public TexenTestCase(String name)
52 {
53 super(name);
54 }
55
56 public static junit.framework.Test suite()
57 {
58 return new TestSuite(TexenTestCase.class);
59 }
60
61
62
63
64 public void setUp()
65 {
66 resultsDir = System.getProperty(RESULTS_DIR_KEY, "bin/test") + "/texen";
67 compareDir = System.getProperty(TEST_DIR_KEY, "test") + "/texen/compare";
68 }
69
70
71
72
73 public void testTexenResults ()
74 throws Exception
75 {
76 TestUtil.assureResultsDirectoryExists(resultsDir);
77
78
79 if (!TestUtil.compareFiles(
80 new File(compareDir, "TurbineWeather.java").toString(),
81 new File(resultsDir, "TurbineWeather.java").toString()) ||
82 !TestUtil.compareFiles(
83 new File(compareDir, "TurbineWeatherService.java").toString(),
84 new File(resultsDir, "TurbineWeatherService.java").toString()) ||
85 !TestUtil.compareFiles(
86 new File(compareDir, "WeatherService.java").toString(),
87 new File(resultsDir, "WeatherService.java").toString()) ||
88 !TestUtil.compareFiles(
89 new File(compareDir, "book.txt").toString(),
90 new File(resultsDir, "book.txt").toString()) ||
91 !TestUtil.compareFiles(
92 new File(compareDir, "Text.txt").toString(),
93 new File(resultsDir, "Text.txt").toString()) )
94 {
95 fail("Texen results are incorrect.");
96 }
97 else
98 {
99 Log.log ("Passed!");
100 }
101 }
102 }