KickJava   Java API By Example, From Geeks To Geeks.

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


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: TexenTestCase.java,v 1.6.10.1 2004/03/03 23:23:04 geirm Exp $
30  */

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

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

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

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

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

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

87         }
88     }
89 }
90
Popular Tags