use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstAssign method testGetType01.
@Test
public void testGetType01() {
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'}", String.class);
Assert.assertEquals(String.class, ve.getType(context));
Assert.assertEquals("hello", ve.getValue(context));
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstAssign method testGetValue02.
@Test
public void testGetValue02() {
ELProcessor processor = new ELProcessor();
processor.defineBean("bean01", new TesterBeanB());
Object result = processor.getValue("bean01.text = 'hello'; bean01.text", String.class);
Assert.assertEquals("hello", result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstConcatenation method testPrecedence01.
/**
* Test operator precedence (+ before +=).
*/
@Test
public void testPrecedence01() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("1 + 2 += 3", String.class);
Assert.assertEquals("33", result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstConcatenation method testConcatenation01.
/**
* Test string concatenation.
*/
@Test
public void testConcatenation01() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("'a' += 'b'", String.class);
Assert.assertEquals("ab", result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstConcatenation method testPrecedence03.
/**
* Test operator precedence (+= before >).
*/
@Test
public void testPrecedence03() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("10 > 2 += 3", String.class);
Assert.assertEquals("false", result);
}
Aggregations