use of javax.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);
assertEquals("New value", ve.getValue(context));
}
use of javax.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);
assertEquals("ABB: Hello AAA from BB", r12.toString());
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug50449a.
@Test
public void testBug50449a() throws Exception {
MethodExpression me1 = factory.createMethodExpression(context, "${beanB.sayHello()}", null, null);
String actual = (String) me1.invoke(context, null);
assertEquals("Hello from B", actual);
}
use of javax.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);
assertEquals(Integer.valueOf(BUG53792.length()), actual);
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithVarArgsAAABB.
@Test
public void testInvokeWithVarArgsAAABB() throws Exception {
MethodExpression me8 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanBB,beanBB)}", null, null);
Object r8 = me8.invoke(context, null);
assertEquals("ABB[]: Hello AAA from BB, BB", r8.toString());
}
Aggregations