org.apache.velocity.test
public class EventHandlingTestCase extends junit.framework.TestCase implements ReferenceInsertionEventHandler, NullSetEventHandler, MethodExceptionEventHandler, LogSystem
Modifier and Type | Field and Description |
---|---|
private boolean |
exceptionSwitch |
private java.lang.String |
logString |
private static java.lang.String |
NO_REFERENCE_VALUE |
private static java.lang.String |
REFERENCE_VALUE |
Constructor and Description |
---|
EventHandlingTestCase()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
init(RuntimeServices rs)
init()
|
void |
logVelocityMessage(int level,
java.lang.String message)
handler for LogSystem interface
|
java.lang.Object |
methodException(java.lang.Class claz,
java.lang.String method,
java.lang.Exception e)
Handles exceptions thrown during in-template method access
|
java.lang.Object |
referenceInsert(java.lang.String reference,
java.lang.Object value)
Event handler for when a reference is inserted into the output stream.
|
void |
runTest()
Runs the test.
|
boolean |
shouldLogOnNullSet(java.lang.String lhs,
java.lang.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
|
countTestCases, createResult, getName, run, run, runBare, setName, setUp, tearDown, toString
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, failNotEquals, failNotSame, failSame
private java.lang.String logString
private boolean exceptionSwitch
private static java.lang.String NO_REFERENCE_VALUE
private static java.lang.String REFERENCE_VALUE
public void init(RuntimeServices rs)
LogSystem
public static junit.framework.Test suite()
public void runTest()
runTest
in class junit.framework.TestCase
public void throwException() throws java.lang.Exception
java.lang.Exception
public java.lang.Object referenceInsert(java.lang.String reference, java.lang.Object value)
referenceInsert
in interface ReferenceInsertionEventHandler
reference
- Reference from template about to be inserted.value
- Value about to be inserted (after its
toString()
method is called).toString()
should be
called for output.public boolean shouldLogOnNullSet(java.lang.String lhs, java.lang.String rhs)
shouldLogOnNullSet
in interface NullSetEventHandler
lhs
- reference literal of left-hand-side of set statementrhs
- reference literal of right-hand-side of set statementpublic java.lang.Object methodException(java.lang.Class claz, java.lang.String method, java.lang.Exception e) throws java.lang.Exception
methodException
in interface MethodExceptionEventHandler
java.lang.Exception
public void logVelocityMessage(int level, java.lang.String message)
logVelocityMessage
in interface LogSystem
Copyright ? 2002 Apache Software Foundation. All Rights Reserved.