use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug53792d.
@Test
public void testBug53792d() {
MethodExpression me = factory.createMethodExpression(context, "#{beanB.sayHello().length()}", null, new Class<?>[] {});
Integer result = (Integer) me.invoke(context, new Object[] { "foo" });
assertEquals(beanB.sayHello().length(), result.intValue());
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithVarArgsABBB.
@Test
public void testInvokeWithVarArgsABBB() throws Exception {
MethodExpression me3 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanBBB,beanBBB)}", null, null);
Object r3 = me3.invoke(context, null);
assertEquals("ABB[]: Hello A from BBB, BBB", r3.toString());
}
use of javax.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);
assertEquals("ABB: Hello A from BB", r6.toString());
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug57855a.
@Test(expected = IllegalArgumentException.class)
public void testBug57855a() {
MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo2}", null, new Class[] { String.class });
me.invoke(context, new Object[0]);
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvoke.
@Test
public void testInvoke() {
MethodExpression me1 = factory.createMethodExpression(context, "${beanB.getName}", String.class, new Class<?>[] {});
MethodExpression me2 = factory.createMethodExpression(context, "${beanB.sayHello('JUnit')}", String.class, new Class<?>[] { String.class });
MethodExpression me3 = factory.createMethodExpression(context, "${beanB.sayHello}", String.class, new Class<?>[] { String.class });
assertEquals("B", me1.invoke(context, null));
assertEquals("Hello JUnit from B", me2.invoke(context, null));
assertEquals("Hello JUnit from B", me2.invoke(context, new Object[] { "JUnit2" }));
assertEquals("Hello JUnit2 from B", me3.invoke(context, new Object[] { "JUnit2" }));
assertEquals("Hello JUnit from B", me2.invoke(context, new Object[] { null }));
assertEquals("Hello from B", me3.invoke(context, new Object[] { null }));
}
Aggregations