use of org.mvel2.compiler.CompiledExpression in project mvel by mikebrock.
the class WithTests method testInlineWith4.
public void testInlineWith4() {
OptimizerFactory.setDefaultOptimizer("ASM");
ExpressionCompiler expr = new ExpressionCompiler("new Foo().{ name = 'bar' }");
ParserContext pCtx = new ParserContext();
pCtx.addImport(Foo.class);
CompiledExpression c = expr.compile(pCtx);
Foo f = (Foo) executeExpression(c);
assertEquals("bar", f.getName());
f = (Foo) executeExpression(c);
assertEquals("bar", f.getName());
}
use of org.mvel2.compiler.CompiledExpression in project mvel by mikebrock.
the class WithTests method testInlineWith3a.
public void testInlineWith3a() {
CompiledExpression expr = new ExpressionCompiler("foo.{name='poopy',aValue='bar',bar.{name='foobie'},toUC('doopy')}").compile();
Foo f = (Foo) executeExpression(expr, createTestMap());
assertEquals("poopy", f.getName());
assertEquals("bar", f.aValue);
assertEquals("foobie", f.getBar().getName());
assertEquals("doopy", f.register);
}
Aggregations