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, CommonsExtPropTestCase, ConfigurationTestCase, ContextSafetyTestCase, EncodingTestCase, InlineScopeVMTestCase, IntrospectorTestCase, IntrospectorTestCase2, IntrospectorTestCase3, MiscTestCase, MultiLoaderTestCase, MultipleFileResourcePathTest, TemplateTestCase, TexenClasspathTestCase, 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.11 2001/08/07 22:20:28 geirm Exp $
Author:
Daniel Rall

Field Summary
private  org.apache.oro.text.perl.Perl5Util perl
          used for nomalization of output and compare data
 
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.
protected  java.lang.String normalizeNewlines(java.lang.String source)
          Normalizes lines to account for platform differences.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

perl

private org.apache.oro.text.perl.Perl5Util perl
used for nomalization of output and compare data
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.

normalizeNewlines

protected java.lang.String normalizeNewlines(java.lang.String source)
Normalizes lines to account for platform differences. Macs use a single \r, DOS derived operating systems use \r\n, and Unix uses \n. Replace each with a single \n.
Returns:
source with all line terminations changed to Unix style

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 © 2003 Apache Software Foundation. All Rights Reserved.