Expression { public Object eval(String expression) { return eval(expression, null); } Expression(ExpressionContext context); Object eval(String expression); Object eval(String expression, Map<String, Object> vars); Object compile(String expression, ExpressionContext pctx); Set<String> analysisInputs(String expression);  }
@Test public void testEval() { String expr = " a && b "; Map<String, Object> dataMap = new HashMap(); dataMap.put("a", Boolean.TRUE); Object flag = expression.eval(expr, dataMap); assertNull(flag); dataMap.put("b", Boolean.TRUE); flag = expression.eval(expr, dataMap); assertThat(flag, is(true)); }
@Test public void testEvalWithEmptyContext() { String expr = " a && b "; Object flag = expression.eval(expr); assertNull(flag); flag = expression.eval(" 1 > 0"); assertThat(flag, is(true)); }