SpelExpressionHelper { public <T> T evaluate(String expressionString, Class<T> desiredResultType, Map<String, Object> variables) { return evaluate(parseExpression(expressionString), desiredResultType, variables); }  T evaluate(String expressionString, Class<T> desiredResultType, Map<String, Object> variables); T evaluate(String expressionString, Map<String, Object> variables); Expression parseExpression(String expressionString); T evaluate(Expression expression, Class<T> desiredResultType, Map<String, Object> variables); T evaluate(Expression expression, Map<String, Object> variables);  }
@Test public void evaluateAssertNoErrorsOnValidExpression() { String expressionString = "#foo"; Map<String, Object> variables = new HashMap<>(); variables.put("foo", "bar"); assertEquals("bar", spelExpressionHelper.evaluate(expressionString, variables)); }
@Test public void evaluateAssertIllegalArgumentOnInvalidExpression() { String expressionString = "this is an invalid expression"; try { spelExpressionHelper.evaluate(expressionString, null); fail(); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); assertEquals("Error parsing SpEL \"this is an invalid expression\"", e.getMessage()); } }