use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithVarArgsAAAB.
@Test
public void testInvokeWithVarArgsAAAB() throws Exception {
MethodExpression me7 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanB,beanB)}", null, null);
Exception e = null;
try {
me7.invoke(context, null);
} catch (Exception e1) {
e = e1;
}
// Expected to fail
Assert.assertNotNull(e);
}
use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug53792b.
@Test
public void testBug53792b() {
MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanB)}", null, new Class<?>[] { TesterBeanB.class });
me.invoke(context, null);
me = factory.createMethodExpression(context, "${beanB.setName('" + BUG53792 + "')}", null, new Class<?>[] { TesterBeanB.class });
me.invoke(context, null);
ValueExpression ve = factory.createValueExpression(context, "#{beanA.getBean().name.length()}", java.lang.Integer.class);
Integer actual = (Integer) ve.getValue(context);
Assert.assertEquals(Integer.valueOf(BUG53792.length()), actual);
}
use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithVarArgsAB.
@Test
public void testInvokeWithVarArgsAB() throws Exception {
MethodExpression me1 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB,beanB)}", null, null);
Exception e = null;
try {
me1.invoke(context, null);
} catch (Exception e1) {
e = e1;
}
// Expected to fail
Assert.assertNotNull(e);
}
use of jakarta.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithSuperAAABB.
@Test
public void testInvokeWithSuperAAABB() {
// 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 me12 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanBB)}", null, null);
Object r12 = me12.invoke(context, null);
Assert.assertEquals("ABB: Hello AAA from BB", r12.toString());
}
use of jakarta.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);
Assert.assertEquals("ABB[]: Hello A from BBB, BBB", r3.toString());
}
Aggregations