EventHandlingTestCase (Velocity 1.4 API)
Keywords: org.apache.velocity.test.EventHandlingTestCase class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.velocity.test
Class EventHandlingTestCase

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              org.apache.velocity.test.EventHandlingTestCase

All Implemented Interfaces:
  EventHandler, LogSystem, MethodExceptionEventHandler, NullSetEventHandler, ReferenceInsertionEventHandler, junit.framework.Test

public class EventHandlingTestCase
extends junit.framework.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
`private boolean` | `exceptionSwitch`
`private java.lang.String` | `logString`
`private static java.lang.String` | `NO_REFERENCE_VALUE`
`private static java.lang.String` | `REFERENCE_VALUE`

Fields inherited from class junit.framework.TestCase
``

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, 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

Methods inherited from class junit.framework.TestCase
`countTestCases, createResult, getName, name, run, run, runBare, setName, setUp, tearDown, toString`

Methods inherited from class junit.framework.Assert
`assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, 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`

Field Detail

### logString

    private java.lang.String logString

### exceptionSwitch

    private boolean exceptionSwitch

### NO_REFERENCE_VALUE

    private static java.lang.String NO_REFERENCE_VALUE

### REFERENCE_VALUE

    private static java.lang.String REFERENCE_VALUE

Constructor Detail

### EventHandlingTestCase

    public EventHandlingTestCase()

  Default constructor.

Method Detail

### init

    public void init(RuntimeServices rs)

  Description copied from interface: `LogSystem`
  init()

  Specified by:
    `init` in interface `LogSystem`

### suite

    public static junit.framework.Test suite()

### runTest

    public void runTest()

  Runs the test.

### throwException

    public void throwException()
                        throws java.lang.Exception

  silly method to throw an exception to test the method invocation exception event handling

  Throws:
    `java.lang.Exception`

### referenceInsert

    public java.lang.Object referenceInsert(java.lang.String reference,
                                            java.lang.Object value)

  Event handler for when a reference 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(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. This method gives the application a chance to 'vote' on msg generation

  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 java.lang.Object methodException(java.lang.Class claz,
                                            java.lang.String method,
                                            java.lang.Exception e)
                                     throws java.lang.Exception

  Handles exceptions thrown during in-template method access

  Specified by:
    `methodException` in interface `MethodExceptionEventHandler`
  Throws:
    `java.lang.Exception`

### logVelocityMessage

    public void logVelocityMessage(int level,
                                   java.lang.String message)

  handler for LogSystem interface

  Specified by:
    `logVelocityMessage` in interface `LogSystem`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 Apache Software Foundation. All Rights Reserved.