use of javax.el.ValueExpression in project tomcat by apache.
the class TestELEvaluation method evaluateExpression.
// ************************************************************************
private String evaluateExpression(String expression) {
ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
ELContextImpl ctx = new ELContextImpl(exprFactory);
ctx.setFunctionMapper(new TesterFunctions.FMapper());
ValueExpression ve = exprFactory.createValueExpression(ctx, expression, String.class);
return (String) ve.getValue(ctx);
}
use of javax.el.ValueExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug52970.
@Test
public void testBug52970() {
MethodExpression me = factory.createMethodExpression(context, "${beanEnum.submit('APPLE')}", null, new Class<?>[] { TesterBeanEnum.class });
me.invoke(context, null);
ValueExpression ve = factory.createValueExpression(context, "#{beanEnum.lastSubmitted}", TesterEnum.class);
TesterEnum actual = (TesterEnum) ve.getValue(context);
assertEquals(TesterEnum.APPLE, actual);
}
use of javax.el.ValueExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug49655.
/*
* This is also tested implicitly in numerous places elsewhere in this
* class.
*/
@Test
public void testBug49655() throws Exception {
// This is the call the failed
MethodExpression me = factory.createMethodExpression(context, "#{beanA.setName('New value')}", null, null);
// The rest is to check it worked correctly
me.invoke(context, null);
ValueExpression ve = factory.createValueExpression(context, "#{beanA.name}", java.lang.String.class);
assertEquals("New value", ve.getValue(context));
}
use of javax.el.ValueExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug53792b.
@Test
public void testBug53792b() {
MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanB)}", null, new Class<?>[] { TesterBeanB.class });
me.invoke(context, null);
me = factory.createMethodExpression(context, "${beanB.setName('" + BUG53792 + "')}", null, new Class<?>[] { TesterBeanB.class });
me.invoke(context, null);
ValueExpression ve = factory.createValueExpression(context, "#{beanA.getBean().name.length()}", java.lang.Integer.class);
Integer actual = (Integer) ve.getValue(context);
assertEquals(Integer.valueOf(BUG53792.length()), actual);
}
use of javax.el.ValueExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug50790b.
@Test
public void testBug50790b() throws Exception {
ValueExpression ve = factory.createValueExpression(context, "#{beanA.name.contains(beanAA.name)}", java.lang.Boolean.class);
Boolean actual = (Boolean) ve.getValue(context);
assertEquals(Boolean.FALSE, actual);
}
Aggregations