ExpressionUtils { public static Object evaluate( String expression, Map<String, Object> vars ) { return evaluate( expression, vars, false ); }  static Object evaluate( String expression, Map<String, Object> vars ); static Double evaluateToDouble( String expression, Map<String, Object> vars ); static boolean isTrue( String expression, Map<String, Object> vars ); static boolean isBoolean( String expression, Map<String, Object> vars ); static boolean isValid( String expression, Map<String, Object> vars ); static boolean isNumeric( String value ); static String asSql( String expression ); static Object evaluate( String expression );  }
@Test public void testEvaluate() { assertEquals( 4, ExpressionUtils.evaluate( "d2:condition('3 > 2',4,3)", null ) ); assertEquals( 3, ExpressionUtils.evaluate( "d2:condition('5 > 7',4,3)", null ) ); assertEquals( "yes", ExpressionUtils.evaluate( "d2:condition(\"'goat' == 'goat'\",'yes','no')", null ) ); assertEquals( "no", ExpressionUtils.evaluate( "d2:condition(\"'goat' != 'goat'\",'yes','no')", null ) ); assertEquals( "indoor", ExpressionUtils.evaluate( "d2:condition(\"'weather' == 'nice'\",'beach','indoor')", null ) ); }