* @throws Exception
*/
public void testReportInvalidReferences1() throws Exception
{
VelocityEngine ve = new VelocityEngine();
ReportInvalidReferences reporter = new ReportInvalidReferences();
ve.init();
VelocityContext context = new VelocityContext();
EventCartridge ec = new EventCartridge();
ec.addEventHandler(reporter);
ec.attachToContext(context);
context.put("a1","test");
context.put("b1","test");
Writer writer = new StringWriter();
ve.evaluate(context,writer,"test","$a1 $c1 $a1.length() $a1.foobar()");
List errors = reporter.getInvalidReferences();
assertEquals(2,errors.size());
assertEquals("$c1",((InvalidReferenceInfo) errors.get(0)).getInvalidReference());
assertEquals("$a1.foobar()",((InvalidReferenceInfo) errors.get(1)).getInvalidReference());
System.out.println("Caught invalid references (local configuration).");