public String evaluate(String elString) {
   if (elString != null) {
     return expressionEvaluator.evaluateExpression(expressionContext, elString, String.class);
   } else {
     return null;
   }
 }
Exemplo n.º 2
0
 @Test
 public void testBean() {
   ExpressionContext context = new ExpressionContext();
   DocumentModel source = doCreateDocument();
   EventContext eventContext = new DocumentEventContext(session, session.getPrincipal(), source);
   Map<String, Serializable> properties = new HashMap<String, Serializable>();
   properties.put("test", "test");
   eventContext.setProperties(properties);
   evaluatorUnderTest.bindValue(context, "context", eventContext);
   DocumentModel value =
       evaluatorUnderTest.evaluateExpression(
           context, "${context.arguments[0]}", DocumentModel.class);
   assertNotNull(value);
   assertEquals(source, value);
   String test =
       evaluatorUnderTest.evaluateExpression(context, "${context.properties.test}", String.class);
   assertNotNull(value);
   assertEquals("test", test);
 }
 public void set(String key, Object value) {
   expressionEvaluator.bindValue(expressionContext, key, value);
 }