Author: remy.maucherat(a)jboss.com
Date: 2011-12-07 11:23:26 -0500 (Wed, 07 Dec 2011)
New Revision: 1884
Modified:
trunk/test/java/org/apache/el/TestMethodExpressionImpl.java
Log:
Add test case.
Modified: trunk/test/java/org/apache/el/TestMethodExpressionImpl.java
===================================================================
--- trunk/test/java/org/apache/el/TestMethodExpressionImpl.java 2011-12-06 15:29:27 UTC
(rev 1883)
+++ trunk/test/java/org/apache/el/TestMethodExpressionImpl.java 2011-12-07 16:23:26 UTC
(rev 1884)
@@ -125,6 +125,37 @@
}
@Test
+ public void testInvoke2825() {
+ TesterBeanB beanB = new TesterBeanB();
+ beanB.setName("B");
+
+ context.getVariableMapper().setVariable("method",
+ factory.createValueExpression("sayHello", String.class));
+ context.getVariableMapper().setVariable("arg",
+ factory.createValueExpression("JUnit", String.class));
+
+ MethodExpression me1 = factory.createMethodExpression(
+ context, "${beanB.getName()}", String.class, new
Class<?>[] {});
+ MethodExpression me2 = factory.createMethodExpression(
+ context, "${beanB[method](arg)}", 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 null from B",
+ me3.invoke(context, new Object[] { null }));
+ }
+
+ @Test
public void testInvokeWithSuper() {
MethodExpression me = factory.createMethodExpression(context,
"${beanA.setBean(beanBB)}", null ,
Show replies by date