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, 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.10 2001/03/23 15:59:17 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, 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 |
perl
private org.apache.oro.text.perl.Perl5Util perl
- used for nomalization of output and compare data
BaseTestCase
public BaseTestCase(java.lang.String name)
- Default constructor.
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 © 2001 Apache Software Foundation. All Rights Reserved.