use of org.mule.mvel2.compiler.CompiledExpression in project mvel by mikebrock.
the class TypesAndInferenceTests method testSetAccessorOverloadedEqualsStrictMode2.
public void testSetAccessorOverloadedEqualsStrictMode2() {
ParserContext ctx = new ParserContext();
ctx.setStrongTyping(true);
ctx.addInput("foo", Foo.class);
try {
CompiledExpression expr = new ExpressionCompiler("foo.aValue = 'bar'").compile(ctx);
} catch (CompileException e) {
assertTrue(false);
}
}
use of org.mule.mvel2.compiler.CompiledExpression in project mvel by mikebrock.
the class WithTests method testInlineWithImpliedThis.
public void testInlineWithImpliedThis() {
Base b = new Base();
ExpressionCompiler expr = new ExpressionCompiler(".{ data = 'foo' }");
CompiledExpression compiled = expr.compile();
executeExpression(compiled, b);
assertEquals(b.data, "foo");
}
use of org.mule.mvel2.compiler.CompiledExpression in project mvel by mikebrock.
the class WithTests method testInlineWith.
public void testInlineWith() {
CompiledExpression expr = new ExpressionCompiler("foo.{name='poopy', aValue='bar'}").compile();
Foo f = (Foo) executeExpression(expr, createTestMap());
assertEquals("poopy", f.getName());
assertEquals("bar", f.aValue);
}
use of org.mule.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.mule.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