org.apache.velocity.test

Class EventHandlingTestCase

public class EventHandlingTestCase extends TestCase implements ReferenceInsertionEventHandler, NullSetEventHandler, MethodExceptionEventHandler, LogSystem

Tests event handling

Version: $Id: EventHandlingTestCase.java,v 1.5.10.1 2004/03/03 23:23:04 geirm Exp $

Author: Geir Magnusson Jr.

Field Summary
booleanexceptionSwitch
StringlogString
static StringNO_REFERENCE_VALUE
static StringREFERENCE_VALUE
Constructor Summary
EventHandlingTestCase()
Default constructor.
Method Summary
voidinit(RuntimeServices rs)
voidlogVelocityMessage(int level, String message)
handler for LogSystem interface
ObjectmethodException(Class claz, String method, Exception e)
Handles exceptions thrown during in-template method access
ObjectreferenceInsert(String reference, Object value)
Event handler for when a reference is inserted into the output stream.
voidrunTest()
Runs the test.
booleanshouldLogOnNullSet(String lhs, String rhs)
Event handler for when the right hand side of a #set() directive is null, which results in a log message.
static Testsuite()
voidthrowException()
silly method to throw an exception to test the method invocation exception event handling

Field Detail

exceptionSwitch

private boolean exceptionSwitch

logString

private String logString

NO_REFERENCE_VALUE

private static String NO_REFERENCE_VALUE

REFERENCE_VALUE

private static String REFERENCE_VALUE

Constructor Detail

EventHandlingTestCase

public EventHandlingTestCase()
Default constructor.

Method Detail

init

public void init(RuntimeServices rs)

logVelocityMessage

public void logVelocityMessage(int level, String message)
handler for LogSystem interface

methodException

public Object methodException(Class claz, String method, Exception e)
Handles exceptions thrown during in-template method access

referenceInsert

public Object referenceInsert(String reference, Object value)
Event handler for when a reference is inserted into the output stream.

runTest

public void runTest()
Runs the test.

shouldLogOnNullSet

public boolean shouldLogOnNullSet(String lhs, String rhs)
Event handler for when the right hand side of a #set() directive is null, which results in a log message. This method gives the application a chance to 'vote' on msg generation

suite

public static Test suite()

throwException

public void throwException()
silly method to throw an exception to test the method invocation exception event handling
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.