1 package org.apache.velocity.test;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import junit.framework.Test;
23 import junit.framework.TestSuite;
24
25
26 /**
27 * This is a test case for Anakia. Right now, it simply will compare
28 * two index.html files together. These are produced as a result of
29 * first running Anakia and then running this test.
30 *
31 * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
32 * @version $Id: AnakiaTestCase.java 463298 2006-10-12 16:10:32Z henning $
33 */
34 public class AnakiaTestCase extends BaseTestCase
35 {
36 private static final String COMPARE_DIR = TEST_COMPARE_DIR + "/anakia/compare";
37 private static final String RESULTS_DIR = TEST_RESULT_DIR + "/anakia";
38
39 private static final String CONTEXT_FILE_EXT = "context.html";
40
41 /**
42 * Creates a new instance.
43 *
44 */
45 public AnakiaTestCase(String name)
46 {
47 super(name);
48 }
49
50 public static Test suite()
51 {
52 return new TestSuite(AnakiaTestCase.class);
53 }
54
55 /**
56 * Runs the test. This is empty on purpose because the
57 * code to do the Anakia output is in the .xml file that runs
58 * this test.
59 */
60 public void testAnakiaResults ()
61 throws Exception
62 {
63 assureResultsDirectoryExists(RESULTS_DIR);
64
65 /**
66 if (!isMatch(RESULTS_DIR,COMPARE_DIR,"index",FILE_EXT,FILE_EXT))
67 {
68 fail("Output is incorrect!");
69 }
70 **/
71
72 if (!isMatch(
73 RESULTS_DIR,
74 COMPARE_DIR,
75 "index",
76 CONTEXT_FILE_EXT,
77 CONTEXT_FILE_EXT))
78 {
79 fail("Custom Context Output is incorrect");
80 }
81 else
82 {
83 System.out.println ("Passed!");
84 }
85 }
86 }