KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > test > TexenClasspathTestCase


1 package org.apache.velocity.test;
2
3 /*
4  * Copyright 2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import java.io.File JavaDoc;
20 import org.apache.velocity.VelocityContext;
21 import org.apache.velocity.util.StringUtils;
22 import junit.framework.TestCase;
23
24 /**
25  * This is a test case for Texen. Simply executes a simple
26  * generative task and compares the output.
27  *
28  * @author <a HREF="mailto:jvanzyl@apache.org">Jason van Zyl</a>
29  * @version $Id: TexenClasspathTestCase.java,v 1.3.10.1 2004/03/03 23:23:04 geirm Exp $
30  */

31 public class TexenClasspathTestCase
32     extends BaseTestCase
33 {
34     /**
35      * Directory where results are generated.
36      */

37     private static final String JavaDoc RESULTS_DIR = "../test/texen-classpath/results";
38
39     /**
40      * Directory where comparison output is stored.
41      */

42     private static final String JavaDoc COMPARE_DIR = "../test/texen-classpath/compare";
43
44     /**
45      * Creates a new instance.
46      *
47      */

48     public TexenClasspathTestCase()
49     {
50         super("TexenClasspathTestCase");
51     }
52
53     public static junit.framework.Test suite()
54     {
55         return new TexenClasspathTestCase();
56     }
57
58     /**
59      * Sets up the test.
60      */

61     protected void setUp ()
62     {
63     }
64
65     /**
66      * Runs the test.
67      */

68     public void runTest ()
69     {
70         try
71         {
72             assureResultsDirectoryExists(RESULTS_DIR);
73             
74             if (!isMatch(RESULTS_DIR,COMPARE_DIR,"TurbineWeather","java","java") ||
75                 !isMatch(RESULTS_DIR,COMPARE_DIR,"TurbineWeatherService","java","java") ||
76                 !isMatch(RESULTS_DIR,COMPARE_DIR,"WeatherService","java","java") ||
77                 !isMatch(RESULTS_DIR,COMPARE_DIR,"book","txt","txt") ||
78                 !isMatch(RESULTS_DIR,COMPARE_DIR,"Test","txt","txt"))
79             {
80                 fail("Output is incorrect!");
81             }
82         }
83         catch(Exception JavaDoc e)
84         {
85             /*
86              * do nothing.
87              */

88         }
89     }
90 }
91
Popular Tags