TemplateTestCase (Velocity 1.4 API)
Keywords: org.apache.velocity.test.TemplateTestCase class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.velocity.test
Class TemplateTestCase

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              org.apache.velocity.test.BaseTestCase
                  org.apache.velocity.test.TemplateTestCase

All Implemented Interfaces:
  TemplateTestBase, junit.framework.Test

public class TemplateTestCase
extends BaseTestCase
implements TemplateTestBase

Easily add test cases which evaluate templates and check their output. NOTE: This class DOES NOT extend RuntimeTestCase because the TemplateTestSuite already initializes the Velocity runtime and adds the template test cases. Having this class extend RuntimeTestCase causes the Runtime to be initialized twice which is not good. I only discovered this after a couple hours of wondering why all the properties being setup were ending up as Vectors. At first I thought it was a problem with the Configuration class, but the Runtime was being initialized twice: so the first time the property is seen it's stored as a String, the second time it's seen the Configuration class makes a Vector with both Strings. As a result all the getBoolean(property) calls were failing because the Configurations class was trying to create a Boolean from a Vector which doesn't really work that well. I have learned my lesson and now have to add some code to make sure the Runtime isn't initialized more then once :-)

Version:
  $Id: TemplateTestCase.java,v 1.34.8.1 2004/03/03 23:23:04 geirm Exp $
Author:
  Daniel Rall, Jason van Zyl, Geir Magnusson Jr., Jon S. Stevens

Field Summary
`private java.util.ArrayList` | `al`
`protected java.lang.String` | `baseFileName` The base file name of the template and comparison file (i.e.
`private VelocityContext` | `context`
`private VelocityContext` | `context1`
`private VelocityContext` | `context2`
`private java.util.Hashtable` | `h`
`private TestProvider` | `provider`
`private java.util.Vector` | `vec`

Fields inherited from class org.apache.velocity.test.BaseTestCase
``

Fields inherited from class junit.framework.TestCase
``

Fields inherited from interface org.apache.velocity.test.TemplateTestBase
`CMP_FILE_EXT, COMPARE_DIR, FILE_RESOURCE_LOADER_PATH, RESULT_DIR, RESULT_FILE_EXT, TEST_CASE_PROPERTIES, TMPL_FILE_EXT`

Constructor Summary
`TemplateTestCase(java.lang.String baseFileName)` Creates a new instance.

Method Summary
`void` | `runTest()` Runs the test.
`protected void` | `setUp()` Sets up the test.
`static junit.framework.Test` | `suite()`

Methods inherited from class org.apache.velocity.test.BaseTestCase
`assureResultsDirectoryExists, getFileName, getTestCaseName, isMatch, normalizeNewlines`

Methods inherited from class junit.framework.TestCase
`countTestCases, createResult, getName, name, run, run, runBare, setName, 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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### baseFileName

    protected java.lang.String baseFileName

  The base file name of the template and comparison file (i.e. array for array.vm and array.cmp).

### provider

    private TestProvider provider

### al

    private java.util.ArrayList al

### h

    private java.util.Hashtable h

### context

    private VelocityContext context

### context1

    private VelocityContext context1

### context2

    private VelocityContext context2

### vec

    private java.util.Vector vec

Constructor Detail

### TemplateTestCase

    public TemplateTestCase(java.lang.String baseFileName)

  Creates a new instance.

Parameters:
  `baseFileName` - The base name of the template and comparison file to use (i.e. array for array.vm and array.cmp).

Method Detail

### suite

    public static junit.framework.Test suite()

### setUp

    protected void setUp()

  Sets up the test.

### runTest

    public void runTest()

  Runs the test.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 Apache Software Foundation. All Rights Reserved.