Search in sources :

Example 1 with Cheesery

use of org.mvel2.tests.core.res.Cheesery in project mvel by mikebrock.

the class CoreConfidenceTests method testDynamicImportsOnNestedExpressions.

public void testDynamicImportsOnNestedExpressions() {
    ParserContext ctx = new ParserContext();
    ctx.addPackageImport("org.mvel2.tests.core.res");
    ExpressionCompiler compiler = new ExpressionCompiler("new Cheesery(\"bobbo\", new Cheese(\"cheddar\", 15))");
    Cheesery p1 = new Cheesery("bobbo", new Cheese("cheddar", 15));
    Cheesery p2 = (Cheesery) executeExpression(compiler.compile(ctx), new DefaultLocalVariableResolverFactory());
    assertEquals(p1, p2);
}
Also used : DefaultLocalVariableResolverFactory(org.mvel2.integration.impl.DefaultLocalVariableResolverFactory) ExpressionCompiler(org.mvel2.compiler.ExpressionCompiler)

Example 2 with Cheesery

use of org.mvel2.tests.core.res.Cheesery in project mvel by mvel.

the class CoreConfidenceTests method testDynamicImportsWithNullConstructorParamWithStrongType.

public void testDynamicImportsWithNullConstructorParamWithStrongType() {
    ParserContext ctx = new ParserContext();
    ctx.setStrongTyping(true);
    ctx.addPackageImport("org.mvel2.tests.core.res");
    ExpressionCompiler compiler = new ExpressionCompiler("new Cheesery(\"bobbo\", null)", ctx);
    Cheesery p1 = new Cheesery("bobbo", null);
    Cheesery p2 = (Cheesery) executeExpression(compiler.compile(), new DefaultLocalVariableResolverFactory());
    assertEquals(p1, p2);
}
Also used : DefaultLocalVariableResolverFactory(org.mvel2.integration.impl.DefaultLocalVariableResolverFactory) ExpressionCompiler(org.mvel2.compiler.ExpressionCompiler) Cheesery(org.mvel2.tests.core.res.Cheesery) ParserContext(org.mvel2.ParserContext)

Example 3 with Cheesery

use of org.mvel2.tests.core.res.Cheesery in project mvel by mvel.

the class CoreConfidenceTests method testDynamicImportsWithNullConstructorParam.

public void testDynamicImportsWithNullConstructorParam() {
    ParserContext ctx = new ParserContext();
    ctx.addPackageImport("org.mvel2.tests.core.res");
    ExpressionCompiler compiler = new ExpressionCompiler("new Cheesery(\"bobbo\", null)", ctx);
    Cheesery p1 = new Cheesery("bobbo", null);
    Cheesery p2 = (Cheesery) executeExpression(compiler.compile(), new DefaultLocalVariableResolverFactory());
    assertEquals(p1, p2);
}
Also used : DefaultLocalVariableResolverFactory(org.mvel2.integration.impl.DefaultLocalVariableResolverFactory) ExpressionCompiler(org.mvel2.compiler.ExpressionCompiler) Cheesery(org.mvel2.tests.core.res.Cheesery) ParserContext(org.mvel2.ParserContext)

Example 4 with Cheesery

use of org.mvel2.tests.core.res.Cheesery in project mvel by mikebrock.

the class CoreConfidenceTests method testDynamicImportsWithNullConstructorParam.

public void testDynamicImportsWithNullConstructorParam() {
    ParserContext ctx = new ParserContext();
    ctx.addPackageImport("org.mvel2.tests.core.res");
    ExpressionCompiler compiler = new ExpressionCompiler("new Cheesery(\"bobbo\", null)");
    Cheesery p1 = new Cheesery("bobbo", null);
    Cheesery p2 = (Cheesery) executeExpression(compiler.compile(ctx), new DefaultLocalVariableResolverFactory());
    assertEquals(p1, p2);
}
Also used : DefaultLocalVariableResolverFactory(org.mvel2.integration.impl.DefaultLocalVariableResolverFactory) ExpressionCompiler(org.mvel2.compiler.ExpressionCompiler)

Example 5 with Cheesery

use of org.mvel2.tests.core.res.Cheesery in project mvel by mvel.

the class CoreConfidenceTests method testDynamicImportsOnNestedExpressions.

public void testDynamicImportsOnNestedExpressions() {
    ParserContext ctx = new ParserContext();
    ctx.addPackageImport("org.mvel2.tests.core.res");
    ExpressionCompiler compiler = new ExpressionCompiler("new Cheesery(\"bobbo\", new Cheese(\"cheddar\", 15))", ctx);
    Cheesery p1 = new Cheesery("bobbo", new Cheese("cheddar", 15));
    Cheesery p2 = (Cheesery) executeExpression(compiler.compile(), new DefaultLocalVariableResolverFactory());
    assertEquals(p1, p2);
}
Also used : DefaultLocalVariableResolverFactory(org.mvel2.integration.impl.DefaultLocalVariableResolverFactory) ExpressionCompiler(org.mvel2.compiler.ExpressionCompiler) Cheese(org.mvel2.tests.core.res.Cheese) Cheesery(org.mvel2.tests.core.res.Cheesery) ParserContext(org.mvel2.ParserContext)

Aggregations

ExpressionCompiler (org.mvel2.compiler.ExpressionCompiler)5 DefaultLocalVariableResolverFactory (org.mvel2.integration.impl.DefaultLocalVariableResolverFactory)5 ParserContext (org.mvel2.ParserContext)3 Cheesery (org.mvel2.tests.core.res.Cheesery)3 Cheese (org.mvel2.tests.core.res.Cheese)1