Search in sources :

Example 21 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuperABReturnTypeParamTypes.

@Test
public void testInvokeWithSuperABReturnTypeParamTypes() {
    MethodExpression me5 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", String.class, new Class<?>[] { TesterBeanA.class, TesterBeanB.class });
    Object r5 = me5.invoke(context, null);
    Assert.assertEquals("AB: Hello A from B", r5.toString());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 22 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuperAAB.

@Test
public void testInvokeWithSuperAAB() {
    MethodExpression me8 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanB)}", null, null);
    Object r8 = me8.invoke(context, null);
    Assert.assertEquals("AAB: Hello AA from B", r8.toString());
}
Also used : MethodExpression(jakarta.el.MethodExpression) Test(org.junit.Test)

Example 23 with MethodExpression

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

Example 24 with MethodExpression

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

the class TestMethodExpressionImpl method testBug56797b.

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

Example 25 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuperAABB.

@Test
public void testInvokeWithSuperAABB() {
    MethodExpression me9 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBB)}", null, null);
    Exception e = null;
    try {
        me9.invoke(context, null);
    } catch (Exception e1) {
        e = e1;
    }
    // Expected to fail
    Assert.assertNotNull(e);
}
Also used : MethodExpression(jakarta.el.MethodExpression) MethodNotFoundException(jakarta.el.MethodNotFoundException) 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