Search in sources :

Example 1 with Status

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

the class CoreConfidenceTests method testPackageImportEnum.

// 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);
// }
public void testPackageImportEnum() {
    String str = "new Status( START )";
    ParserConfiguration pconf = new ParserConfiguration();
    pconf.addPackageImport("org.mvel2.tests.core.res");
    pconf.addPackageImport("org.mvel2.tests.core.res.Status");
    ParserContext context = new ParserContext(pconf);
    context.setStrongTyping(true);
    Serializable s = MVEL.compileExpression(str.trim(), context);
    assertEquals(new Status(Status.START), MVEL.executeExpression(s));
    assertFalse(new Status(Status.STOP).equals(MVEL.executeExpression(s)));
}
Also used : Status(org.mvel2.tests.core.res.Status) Serializable(java.io.Serializable) ParserContext(org.mvel2.ParserContext) ParserConfiguration(org.mvel2.ParserConfiguration)

Aggregations

Serializable (java.io.Serializable)1 ParserConfiguration (org.mvel2.ParserConfiguration)1 ParserContext (org.mvel2.ParserContext)1 Status (org.mvel2.tests.core.res.Status)1