org.apache.velocity.test.misc
Class Test

java.lang.Object
  extended by org.apache.velocity.test.misc.Test
All Implemented Interfaces:
EventHandler, MethodExceptionEventHandler, NullSetEventHandler, ReferenceInsertionEventHandler

public class Test
extends Object
implements ReferenceInsertionEventHandler, NullSetEventHandler, MethodExceptionEventHandler

This class the testbed for Velocity. It is used to test all the directives support by Velocity.

Version:
$Id: Test.java 191743 2005-06-21 23:22:20Z dlr $
Author:
Jason van Zyl, Geir Magnusson Jr.

Constructor Summary
Test(String templateFile, String encoding)
           
 
Method Summary
static void main(String[] args)
           
 Object methodException(Class claz, String method, Exception e)
           
 Object referenceInsert(String reference, Object value)
          A call-back which is executed during Velocity merge before a reference value is inserted into the output stream.
 boolean shouldLogOnNullSet(String lhs, String rhs)
          Called when the RHS of a #set() is null, which will result in a null LHS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Test

public Test(String templateFile,
            String encoding)
Method Detail

referenceInsert

public Object referenceInsert(String reference,
                              Object value)
Description copied from interface: ReferenceInsertionEventHandler
A call-back which is executed during Velocity merge before a reference value is inserted into the output stream.

Specified by:
referenceInsert in interface ReferenceInsertionEventHandler
Parameters:
reference - Reference from template about to be inserted.
value - Value about to be inserted (after its toString() method is called).
Returns:
Object on which toString() should be called for output.

shouldLogOnNullSet

public boolean shouldLogOnNullSet(String lhs,
                                  String rhs)
Description copied from interface: NullSetEventHandler
Called when the RHS of a #set() is null, which will result in a null LHS.

Specified by:
shouldLogOnNullSet in interface NullSetEventHandler
Parameters:
lhs - reference literal of left-hand-side of set statement
rhs - reference literal of right-hand-side of set statement
Returns:
true if log message should be written, false otherwise

methodException

public Object methodException(Class claz,
                              String method,
                              Exception e)
                       throws Exception
Specified by:
methodException in interface MethodExceptionEventHandler
Throws:
Exception

main

public static void main(String[] args)


Copyright © 2002 Apache Software Foundation. All Rights Reserved.