org.apache.velocity.test
Class BaseTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.apache.velocity.test.BaseTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AnakiaTestCase, ClasspathResourceTest, ConfigurationTestCase, ContextSafetyTestCase, InlineScopeVMTestCase, IntrospectorTestCase, MultiLoaderTestCase, MultipleFileResourcePathTest, TemplateTestCase, TexenTestCase, VelocityAppTestCase

public class BaseTestCase
extends junit.framework.TestCase

Base test case that provides a few utility methods for the rest of the tests.

Version:
$Id: BaseTestCase.java,v 1.9 2001/03/20 01:11:36 jon Exp $
Author:
Daniel Rall

Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
BaseTestCase(java.lang.String name)
          Default constructor.
 
Method Summary
protected static void assureResultsDirectoryExists(java.lang.String resultsDirectory)
          Assures that the results directory exists.
protected static java.lang.String getFileName(java.lang.String dir, java.lang.String base, java.lang.String ext)
          Concatenates the file name parts together appropriately.
protected static java.lang.String getTestCaseName(java.lang.String s)
          Turns a base file name into a test case name.
protected  boolean isMatch(java.lang.String resultsDir, java.lang.String compareDir, java.lang.String baseFileName, java.lang.String resultExt, java.lang.String compareExt)
          Returns whether the processed template matches the content of the provided comparison file.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, name, run, run, runBare, runTest, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

BaseTestCase

public BaseTestCase(java.lang.String name)
Default constructor.
Method Detail

getFileName

protected static java.lang.String getFileName(java.lang.String dir,
                                              java.lang.String base,
                                              java.lang.String ext)
Concatenates the file name parts together appropriately.
Returns:
The full path to the file.

assureResultsDirectoryExists

protected static void assureResultsDirectoryExists(java.lang.String resultsDirectory)
Assures that the results directory exists. If the results directory cannot be created, fails the test.

isMatch

protected boolean isMatch(java.lang.String resultsDir,
                          java.lang.String compareDir,
                          java.lang.String baseFileName,
                          java.lang.String resultExt,
                          java.lang.String compareExt)
                   throws java.lang.Exception
Returns whether the processed template matches the content of the provided comparison file.
Returns:
Whether the output matches the contents of the comparison file.
Throws:
java.lang.Exception - Test failure condition.

getTestCaseName

protected static final java.lang.String getTestCaseName(java.lang.String s)
Turns a base file name into a test case name.
Parameters:
s - The base file name.
Returns:
The test case name.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.