Search in sources :

Example 26 with MethodExpression

use of jakarta.el.MethodExpression in project tomcat by apache.

the class TestMethodExpressionImpl method testBug50449b.

@Test
public void testBug50449b() throws Exception {
    MethodExpression me1 = factory.createMethodExpression(context, "${beanB.sayHello('Tomcat')}", null, null);
    String actual = (String) me1.invoke(context, null);
    Assert.assertEquals("Hello Tomcat from B", actual);
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 27 with MethodExpression

use of jakarta.el.MethodExpression in project tomcat by apache.

the class TestMethodExpressionImpl method testInvokeWithSuperABB.

@Test
public void testInvokeWithSuperABB() {
    MethodExpression me6 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanBB)}", null, null);
    Object r6 = me6.invoke(context, null);
    Assert.assertEquals("ABB: Hello A from BB", r6.toString());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 28 with MethodExpression

use of jakarta.el.MethodExpression in project tomcat by apache.

the class TestMethodExpressionImpl method testInvokeWithSuperABBB.

@Test
public void testInvokeWithSuperABBB() {
    MethodExpression me7 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanBBB)}", null, null);
    Object r7 = me7.invoke(context, null);
    Assert.assertEquals("ABB: Hello A from BBB", r7.toString());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 29 with MethodExpression

use of jakarta.el.MethodExpression 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);
}
Also used : ValueExpression(jakarta.el.ValueExpression) MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 30 with MethodExpression

use of jakarta.el.MethodExpression in project tomcat by apache.

the class TestMethodExpressionImpl method testBug56797a.

@Test
public void testBug56797a() {
    MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo1('Hello World!')}", null, null);
    Object r = me.invoke(context, null);
    Assert.assertEquals("AA1Hello World!", r.toString());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Aggregations

MethodExpression (jakarta.el.MethodExpression)45 Test (org.junit.Test)44 ValueExpression (jakarta.el.ValueExpression)7 MethodNotFoundException (jakarta.el.MethodNotFoundException)6 MethodInfo (jakarta.el.MethodInfo)2 ELException (jakarta.el.ELException)1 VariableMapper (jakarta.el.VariableMapper)1