Search in sources :

Example 36 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuper.

@Test
public void testInvokeWithSuper() {
    MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanBB)}", null, new Class<?>[] { TesterBeanB.class });
    me.invoke(context, null);
    ValueExpression ve = factory.createValueExpression(context, "${beanA.bean.name}", String.class);
    Object r = ve.getValue(context);
    Assert.assertEquals("BB", r);
}
Also used : ValueExpression(jakarta.el.ValueExpression) MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 37 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithVarArgsAABBB.

@Test
public void testInvokeWithVarArgsAABBB() throws Exception {
    MethodExpression me6 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBBB,beanBBB)}", null, null);
    Object r6 = me6.invoke(context, null);
    Assert.assertEquals("ABB[]: Hello AA from BBB, BBB", r6.toString());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 38 with MethodExpression

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

the class TestMethodExpressionImpl method testBug53792c.

@Test
public void testBug53792c() {
    MethodExpression me = factory.createMethodExpression(context, "#{beanB.sayHello().length()}", null, new Class<?>[] {});
    Integer result = (Integer) me.invoke(context, null);
    Assert.assertEquals(beanB.sayHello().length(), result.intValue());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 39 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuperABReturnTypeNoParamTypes.

@Test
public void testInvokeWithSuperABReturnTypeNoParamTypes() {
    MethodExpression me3 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", String.class, null);
    Object r3 = me3.invoke(context, null);
    Assert.assertEquals("AB: Hello A from B", r3.toString());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 40 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuperABNoReturnTypeParamTypes.

@Test
public void testInvokeWithSuperABNoReturnTypeParamTypes() {
    MethodExpression me4 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", null, new Class<?>[] { TesterBeanA.class, TesterBeanB.class });
    Object r4 = me4.invoke(context, null);
    Assert.assertEquals("AB: Hello A from B", r4.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