use of jakarta.el.ValueExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug53792a.
@Test
public void testBug53792a() {
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}", java.lang.String.class);
String actual = (String) ve.getValue(context);
Assert.assertEquals(BUG53792, actual);
}
use of jakarta.el.ValueExpression in project tomcat by apache.
the class TestAstMapData method testGetType.
@Test
public void testGetType() {
ELProcessor processor = new ELProcessor();
ELContext context = processor.getELManager().getELContext();
ExpressionFactory factory = ELManager.getExpressionFactory();
ValueExpression ve = factory.createValueExpression(context, "${{'a':'1','b':'2','c':'3'}}", Map.class);
Assert.assertEquals(Map.class, ve.getType(context));
Assert.assertEquals(simpleMap, ve.getValue(context));
}
use of jakarta.el.ValueExpression in project tomcat by apache.
the class TestAstAssign method testGetType02.
@Test
public void testGetType02() {
ELProcessor processor = new ELProcessor();
ELContext context = processor.getELManager().getELContext();
ExpressionFactory factory = ELManager.getExpressionFactory();
processor.defineBean("bean01", new TesterBeanB());
ValueExpression ve = factory.createValueExpression(context, "${bean01.text = 'hello'; bean01.text}", String.class);
Assert.assertEquals(String.class, ve.getType(context));
Assert.assertEquals("hello", ve.getValue(context));
}
use of jakarta.el.ValueExpression in project tomcat by apache.
the class TestAstConcatenation method testGetType.
@Test
public void testGetType() {
ELProcessor processor = new ELProcessor();
ELContext context = processor.getELManager().getELContext();
ExpressionFactory factory = ELManager.getExpressionFactory();
ValueExpression ve = factory.createValueExpression(context, "${'a' += 3}", String.class);
Assert.assertEquals(String.class, ve.getType(context));
Assert.assertEquals("a3", ve.getValue(context));
}
use of jakarta.el.ValueExpression in project tomcat by apache.
the class TestAstListData method testGetType.
@Test
public void testGetType() {
ELProcessor processor = new ELProcessor();
ELContext context = processor.getELManager().getELContext();
ExpressionFactory factory = ELManager.getExpressionFactory();
ValueExpression ve = factory.createValueExpression(context, "${['a','b','c','b','c']}", List.class);
Assert.assertEquals(List.class, ve.getType(context));
Assert.assertEquals(simpleList, ve.getValue(context));
}
Aggregations