Search in sources :

Example 31 with MethodExpression

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

the class TestMethodExpressionImpl method testBug57855d.

@Test
public void testBug57855d() {
    MethodExpression me = factory.createMethodExpression(context, "${beanB.echo}", null, new Class[] { String.class });
    Object r = me.invoke(context, new String[] { "aaa" });
    assertEquals("aaa", r.toString());
}
Also used : MethodExpression(javax.el.MethodExpression) Test(org.junit.Test)

Example 32 with MethodExpression

use of javax.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);
    assertEquals(beanB.sayHello().length(), result.intValue());
}
Also used : MethodExpression(javax.el.MethodExpression) Test(org.junit.Test)

Example 33 with MethodExpression

use of javax.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);
    assertEquals("AB: Hello A from B", r3.toString());
}
Also used : MethodExpression(javax.el.MethodExpression) Test(org.junit.Test)

Example 34 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuperABNoReturnTypeNoParamTypes.

@Test
public void testInvokeWithSuperABNoReturnTypeNoParamTypes() {
    MethodExpression me2 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", null, null);
    Object r2 = me2.invoke(context, null);
    assertEquals("AB: Hello A from B", r2.toString());
}
Also used : MethodExpression(javax.el.MethodExpression) Test(org.junit.Test)

Example 35 with MethodExpression

use of javax.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);
    assertEquals("AB: Hello A from B", r4.toString());
}
Also used : MethodExpression(javax.el.MethodExpression) Test(org.junit.Test)

Aggregations

MethodExpression (javax.el.MethodExpression)42 Test (org.junit.Test)41 ValueExpression (javax.el.ValueExpression)7 ELException (javax.el.ELException)1 MethodNotFoundException (javax.el.MethodNotFoundException)1 VariableMapper (javax.el.VariableMapper)1