VelocityContext base = new VelocityContext();
try
{
// initialize with bad class name
RuntimeInstance instance = new RuntimeInstance();
instance.setProperty(RuntimeConstants.EVALUATE_CONTEXT_CLASS, "org.apache");
instance.init();
EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);
fail ("Expected an exception");
}
catch (Exception e) {}
try
{
// initialize with class not implementing Context
RuntimeInstance instance = new RuntimeInstance();
instance.setProperty(RuntimeConstants.EVALUATE_CONTEXT_CLASS, org.apache.velocity.test.EvaluateContextTestCase.class.getName());
instance.init();
EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);
fail ("Expected an exception");
}
catch (Exception e) {}
}