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.Test;
28 import junit.framework.TestCase;
29 import junit.framework.TestSuite;
30
31
32
33
34
35
36
37
38
39
40 public class TexenClasspathTestCase extends TestCase
41 {
42 public static final String TEST_DIR_KEY = "test.compare.dir";
43 public static final String RESULTS_DIR_KEY = "test.results.dir";
44
45 private String resultsDir;
46 private String compareDir;
47
48
49
50
51
52 public TexenClasspathTestCase(String name)
53 {
54 super(name);
55 }
56
57 public static Test suite()
58 {
59 return new TestSuite(TexenClasspathTestCase.class);
60 }
61
62
63
64
65 public void setUp()
66 {
67 resultsDir = System.getProperty(RESULTS_DIR_KEY, "bin/test") + "/texen";
68 compareDir = System.getProperty(TEST_DIR_KEY, "test") + "/texen/compare";
69 }
70
71
72
73
74 public void testTexenClasspath()
75 throws Exception
76 {
77 TestUtil.assureResultsDirectoryExists(resultsDir);
78
79
80 if (!TestUtil.compareFiles(
81 new File(compareDir, "TurbineWeather.java").toString(),
82 new File(resultsDir, "TurbineWeather.java").toString()) ||
83 !TestUtil.compareFiles(
84 new File(compareDir, "TurbineWeatherService.java").toString(),
85 new File(resultsDir, "TurbineWeatherService.java").toString()) ||
86 !TestUtil.compareFiles(
87 new File(compareDir, "WeatherService.java").toString(),
88 new File(resultsDir, "WeatherService.java").toString()) ||
89 !TestUtil.compareFiles(
90 new File(compareDir, "book.txt").toString(),
91 new File(resultsDir, "book.txt").toString()) ||
92 !TestUtil.compareFiles(
93 new File(compareDir, "Text.txt").toString(),
94 new File(resultsDir, "Text.txt").toString()) )
95 {
96 fail("Texen results are incorrect.");
97 }
98 else
99 {
100 Log.log ("Passed!");
101 }
102 }
103 }