Search in sources :

Example 36 with MethodExpression

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

the class TestMethodExpressionImpl method testBug57855e.

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

Example 37 with MethodExpression

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

the class TestMethodExpressionImpl method testBug57855c.

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

Example 38 with MethodExpression

use of javax.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);
    assertEquals("BB", r);
}
Also used : ValueExpression(javax.el.ValueExpression) MethodExpression(javax.el.MethodExpression) Test(org.junit.Test)

Example 39 with MethodExpression

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

the class TestMethodExpressionImpl method testBug52445a.

@Test
public void testBug52445a() {
    MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanBB)}", null, new Class<?>[] { TesterBeanB.class });
    me.invoke(context, null);
    MethodExpression me1 = factory.createMethodExpression(context, "${beanA.bean.sayHello()}", null, null);
    String actual = (String) me1.invoke(context, null);
    assertEquals("Hello from BB", actual);
}
Also used : MethodExpression(javax.el.MethodExpression) Test(org.junit.Test)

Example 40 with MethodExpression

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

the class TestMethodExpressionImpl method testInvokeWithSuperAABBB.

@Test
public void testInvokeWithSuperAABBB() {
    // The Java compiler reports this as ambiguous. Using the parameter that
    // matches exactly seems reasonable to limit the scope of the method
    // search so the EL will find a match.
    MethodExpression me10 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBBB)}", null, null);
    Object r10 = me10.invoke(context, null);
    assertEquals("AAB: Hello AA from BBB", r10.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