org.apache.velocity.test
Class StrictReferenceTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.velocity.test.BaseTestCase
              extended by org.apache.velocity.test.StrictReferenceTestCase
All Implemented Interfaces:
junit.framework.Test, TemplateTestBase

public class StrictReferenceTestCase
extends BaseTestCase

Test strict reference mode turned on by the velocity property runtime.references.strict


Nested Class Summary
static class StrictReferenceTestCase.Fargo
           
 
Field Summary
 
Fields inherited from class org.apache.velocity.test.BaseTestCase
context, DEBUG, engine, log, stringRepoName
 
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, TEST_COMPARE_DIR, TEST_RESULT_DIR, TMPL_FILE_EXT
 
Constructor Summary
StrictReferenceTestCase(String name)
           
 
Method Summary
 void assertMethodEx(String template)
          Assert that we get a MethodInvocationException when calling evaluate
 void assertParseEx(String template)
          Assert that we get a MethodInvocationException when calling evaluate
 void assertVelocityEx(String template)
          Assert that we get a VelocityException when calling evaluate
 void setUp()
           
 void testAllowNullValues()
          We make sure that variables can actuall hold null values.
 void testIfStatement()
          Test the modified behavior of #if in strict mode.
 void testMacros()
          Make sure undefined macros throw exceptions
 void testRenderingNull()
           
 void testStrictMethodOnNull()
          Make sure exceptions are thrown when when we attempt to call methods on null values.
 void testStrictMethodRef()
          Test that exceptions are thrown when methods are called on references that contains objects that do not contains those methods.
 void testStrictVariableRef()
          Test that variables references that have not been defined throw exceptions
 
Methods inherited from class org.apache.velocity.test.BaseTestCase
addTemplate, assertContextValue, assertEvalEquals, assertEvalException, assertEvalException, assertEvalExceptionAt, assertEvalExceptionAt, assertSchmoo, assertTmplEquals, assureResultsDirectoryExists, evaluate, getFileContents, getFileName, getFileName, getStringRepository, getTestCaseName, info, info, isMatch, isMatch, normalizeNewlines, removeTemplate, setUpContext, setUpEngine, tearDown, testBase
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, 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
 

Constructor Detail

StrictReferenceTestCase

public StrictReferenceTestCase(String name)
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class BaseTestCase
Throws:
Exception

testIfStatement

public void testIfStatement()
Test the modified behavior of #if in strict mode. Mainly, that single variables references in #if statements use non strict rules


testAllowNullValues

public void testAllowNullValues()
                         throws Exception
We make sure that variables can actuall hold null values.

Throws:
Exception

testStrictVariableRef

public void testStrictVariableRef()
                           throws Exception
Test that variables references that have not been defined throw exceptions

Throws:
Exception

testStrictMethodRef

public void testStrictMethodRef()
Test that exceptions are thrown when methods are called on references that contains objects that do not contains those methods.


testStrictMethodOnNull

public void testStrictMethodOnNull()
Make sure exceptions are thrown when when we attempt to call methods on null values.


testMacros

public void testMacros()
Make sure undefined macros throw exceptions


testRenderingNull

public void testRenderingNull()

assertMethodEx

public void assertMethodEx(String template)
Assert that we get a MethodInvocationException when calling evaluate


assertVelocityEx

public void assertVelocityEx(String template)
Assert that we get a VelocityException when calling evaluate


assertParseEx

public void assertParseEx(String template)
Assert that we get a MethodInvocationException when calling evaluate



Copyright © 2000-2010 The Apache Software Foundation. All Rights Reserved.