use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug57855a.
@Test(expected = MethodNotFoundException.class)
public void testBug57855a() {
MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo2}", null, new Class[] { String.class });
me.invoke(context, new Object[0]);
}
use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testIsParametersProvided.
@Test
public void testIsParametersProvided() {
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 });
Assert.assertFalse(me1.isParametersProvided());
Assert.assertTrue(me2.isParametersProvided());
}
use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testGetMethodInfo02.
@Test
public void testGetMethodInfo02() throws Exception {
MethodExpression me = factory.createMethodExpression(context, "#{beanA.setName}", null, new Class[] { String.class });
// This is the call that failed
MethodInfo mi = me.getMethodInfo(context);
// The rest is to check it worked correctly
Assert.assertEquals(void.class, mi.getReturnType());
Assert.assertEquals(1, mi.getParamTypes().length);
Assert.assertEquals(String.class, mi.getParamTypes()[0]);
}
use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithVarArgsAAABBB.
@Test
public void testInvokeWithVarArgsAAABBB() throws Exception {
MethodExpression me9 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanBBB,beanBBB)}", null, null);
Object r9 = me9.invoke(context, null);
Assert.assertEquals("ABB[]: Hello AAA from BBB, BBB", r9.toString());
}
use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug49655.
/*
* This is also tested implicitly in numerous places elsewhere in this
* class.
*/
@Test
public void testBug49655() throws Exception {
// This is the call the failed
MethodExpression me = factory.createMethodExpression(context, "#{beanA.setName('New value')}", null, null);
// The rest is to check it worked correctly
me.invoke(context, null);
ValueExpression ve = factory.createValueExpression(context, "#{beanA.name}", java.lang.String.class);
Assert.assertEquals("New value", ve.getValue(context));
}
Aggregations