geirm 01/06/02 07:34:18
Modified: src/java/org/apache/velocity/test Tag: VEL_1_1_BRANCH
EventHandlingTestCase.java
Log:
Added test to make sure that context chaining (wrapping) is safe for
event handlers.
Revision Changes Path
No revision
No revision
1.3.2.1 +14 -7
jakarta-velocity/src/java/org/apache/velocity/test/EventHandlingTestCase.java
Index: EventHandlingTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/test/EventHandlingTestCase.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- EventHandlingTestCase.java 2001/05/20 21:14:32 1.3
+++ EventHandlingTestCase.java 2001/06/02 14:34:18 1.3.2.1
@@ -74,7 +74,7 @@
* Tests event handling
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: EventHandlingTestCase.java,v 1.3 2001/05/20 21:14:32 geirm Exp $
+ * @version $Id: EventHandlingTestCase.java,v 1.3.2.1 2001/06/02 14:34:18 geirm Exp
$
*/
public class EventHandlingTestCase extends TestCase implements
ReferenceInsertionEventHandler,
NullSetEventHandler,
MethodExceptionEventHandler,
@@ -120,13 +120,11 @@
public void runTest ()
{
/*
- * lets make a Context and add some data
+ * lets make a Context and add the event cartridge
*/
- VelocityContext context = new VelocityContext();
-
- context.put("name", "Velocity");
-
+ VelocityContext inner = new VelocityContext();
+
/*
* Now make an event cartridge, register all the
* event handlers (at once) and attach it to the
@@ -135,8 +133,17 @@
EventCartridge ec = new EventCartridge();
ec.addEventHandler(this);
- ec.attachToContext( context );
+ ec.attachToContext( inner );
+ /*
+ * now wrap the event cartridge - we want to make sure that
+ * we can do this w/o harm
+ */
+
+ VelocityContext context = new VelocityContext( inner );
+
+ context.put("name", "Velocity");
+
try
{
/*