use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testBug53792a.
@Test
public void testBug53792a() {
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}", java.lang.String.class);
String actual = (String) ve.getValue(context);
assertEquals(BUG53792, actual);
}
use of javax.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 });
assertFalse(me1.isParametersProvided());
assertTrue(me2.isParametersProvided());
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithSuperABReturnTypeParamTypes.
@Test
public void testInvokeWithSuperABReturnTypeParamTypes() {
MethodExpression me5 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", String.class, new Class<?>[] { TesterBeanA.class, TesterBeanB.class });
Object r5 = me5.invoke(context, null);
assertEquals("AB: Hello A from B", r5.toString());
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithSuperAAB.
@Test
public void testInvokeWithSuperAAB() {
MethodExpression me8 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanB)}", null, null);
Object r8 = me8.invoke(context, null);
assertEquals("AAB: Hello AA from B", r8.toString());
}
use of javax.el.MethodExpression in project tomcat by apache.
the class TestMethodExpressionImpl method testInvokeWithSuperAABB.
@Test
public void testInvokeWithSuperAABB() {
MethodExpression me9 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBB)}", null, null);
Exception e = null;
try {
me9.invoke(context, null);
} catch (Exception e1) {
e = e1;
}
// Expected to fail
assertNotNull(e);
}
Aggregations