org.apache.velocity.test

Class EventHandlingTestCase

Implemented Interfaces:
EventHandler, LogSystem, MethodExceptionEventHandler, NullSetEventHandler, ReferenceInsertionEventHandler

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

Tests event handling

Version:
$Id: EventHandlingTestCase.java,v 1.5 2001/08/07 22:20:28 geirm Exp $

Author:
Geir Magnusson Jr.

Nested Class Summary

Field Summary

private static String
NO_REFERENCE_VALUE
private static String
REFERENCE_VALUE
private boolean
exceptionSwitch
private String
logString

Fields inherited from interface org.apache.velocity.runtime.log.LogSystem

DEBUG_ID, DEBUG_ON, ERROR_ID, INFO_ID, WARN_ID

Constructor Summary

EventHandlingTestCase()
Default constructor.

Method Summary

void
init(RuntimeServices rs)
init()
void
logVelocityMessage(int level, String message)
handler for LogSystem interface
Object
methodException(Class claz, String method, Exception e)
Handles exceptions thrown during in-template method access
Object
referenceInsert(String reference, Object value)
Event handler for when a reference is inserted into the output stream.
void
runTest()
Runs the test.
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.
static junit.framework.Test
suite()
void
throwException()
silly method to throw an exception to test the method invocation exception event handling

Field Details

NO_REFERENCE_VALUE

private static String NO_REFERENCE_VALUE


REFERENCE_VALUE

private static String REFERENCE_VALUE


exceptionSwitch

private boolean exceptionSwitch


logString

private String logString

Constructor Details

EventHandlingTestCase

public EventHandlingTestCase()
Default constructor.

Method Details

init

public void init(RuntimeServices rs)
init()
Specified by:
init in interface LogSystem


logVelocityMessage

public void logVelocityMessage(int level,
                               String message)
handler for LogSystem interface
Specified by:
logVelocityMessage in interface LogSystem


methodException

public Object methodException(Class claz,
                              String method,
                              Exception e)
            throws Exception
Handles exceptions thrown during in-template method access
Specified by:
methodException in interface MethodExceptionEventHandler


referenceInsert

public Object referenceInsert(String reference,
                              Object value)
Event handler for when a reference is inserted into the output stream.
Specified by:
referenceInsert in interface ReferenceInsertionEventHandler


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
Specified by:
shouldLogOnNullSet in interface NullSetEventHandler


suite

public static junit.framework.Test suite()


throwException

public void throwException()
            throws Exception
silly method to throw an exception to test the method invocation exception event handling


Copyright © 2003 Apache Software Foundation. All Rights Reserved.