use of org.mvel2.tests.core.res.Foo in project mvel by mikebrock.
the class CoreConfidenceTests method testJIRA156b.
public void testJIRA156b() throws Throwable {
ClassProvider provider = new ClassProvider();
provider.getPrivate().foo();
PublicClass.class.getMethod("foo").invoke(provider.getPrivate());
String script = "provider.getPrivate().foo()";
Serializable s = MVEL.compileExpression(script);
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("provider", provider);
OptimizerFactory.setDefaultOptimizer("reflective");
executeExpression(s, vars);
OptimizerFactory.setDefaultOptimizer("ASM");
executeExpression(s, vars);
}
use of org.mvel2.tests.core.res.Foo in project mvel by mikebrock.
the class CoreConfidenceTests method testSysoutNullVariable.
public void testSysoutNullVariable() {
// Create our root Map object
Map<String, String> map = new HashMap<String, String>();
map.put("foo", null);
VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
factory.createVariable("this", map);
org.mvel2.MVEL.executeExpression(org.mvel2.MVEL.compileExpression("System.out.println(foo);"), map, factory);
}
use of org.mvel2.tests.core.res.Foo in project mvel by mikebrock.
the class CoreConfidenceTests method testJIRA156.
public void testJIRA156() throws Throwable {
ClassProvider provider = new ClassProvider();
provider.getPrivate().foo();
PublicClass.class.getMethod("foo").invoke(provider.getPrivate());
String script = "provider.getPrivate().foo()";
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("provider", provider);
MVEL.eval(script, vars);
}
use of org.mvel2.tests.core.res.Foo in project mvel by mikebrock.
the class CoreConfidenceTests method testThisReferenceMapVirtualObjects1.
// compiled - reflective
public void testThisReferenceMapVirtualObjects1() {
// Create our root Map object
Map<String, String> map = new HashMap<String, String>();
map.put("foo", "bar");
VariableResolverFactory factory = new MapVariableResolverFactory(new HashMap<String, Object>());
factory.createVariable("this", map);
OptimizerFactory.setDefaultOptimizer("reflective");
// Run test
assertEquals(true, executeExpression(compileExpression("this.foo == 'bar'"), map, factory));
}
use of org.mvel2.tests.core.res.Foo in project mvel by mikebrock.
the class FailureTests method testShouldFail7.
public void testShouldFail7() {
try {
ParserContext pctx = new ParserContext();
pctx.setStrongTyping(true);
MVEL.compileExpression("String x = 'foo'; int y = 2; new int[] { x, y }", pctx);
} catch (Exception e) {
// e.printStackTrace();
return;
}
shouldThrowException();
}
Aggregations