Skip to content

Instantly share code, notes, and snippets.

@mdproctor
Created January 26, 2012 20:42
Show Gist options
  • Save mdproctor/1684970 to your computer and use it in GitHub Desktop.
Save mdproctor/1684970 to your computer and use it in GitHub Desktop.
@Test
public void testOperatorWithoutSpace() {
String str = "length == ($c.length -1)"; // only works with a space after the minus operator
ParserConfiguration pconf = new ParserConfiguration();
ParserContext pctx = new ParserContext(pconf);
ExecutableStatement stmt = (ExecutableStatement) MVEL.compileExpression(str, pctx);
Column col1 = new Column("x",0);
Column col2 = new Column("x", 0);
Map<String, Object> vars = new HashMap<String, Object> ();
vars.put( "$c", col2 );
Boolean result = (Boolean) MVEL.executeExpression(stmt, col1, vars);
assertFalse(result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment