Author: markt
Date: Sun Apr  4 10:08:04 2010
New Revision: 930652

URL: http://svn.apache.org/viewvc?rev=930652&view=rev
Log:
Modify unit tests to take account of 
https://issues.apache.org/bugzilla/show_bug.cgi?id=48914
Invoke should use parameters provided in expression in preference to parameters 
provided in invoke() call

Modified:
    tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java

Modified: tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java?rev=930652&r1=930651&r2=930652&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java (original)
+++ tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java Sun Apr  4 
10:08:04 2010
@@ -44,13 +44,33 @@ public class TestMethodExpressionImpl ex
                 context, "${beanB.sayHello('JUnit')}", String.class,
                 new Class<?>[] { String.class });
 
-        String result1 = (String) me1.invoke(context, null);
         assertFalse(me1.isParmetersProvided());
-        String result2 = (String) me2.invoke(context, new Object[] { "JUnit2" 
});
         assertTrue(me2.isParmetersProvided());
-        
-        assertNotNull(result1);
-        assertNotNull(result2);
+    }
+
+    public void testInvoke() {
+        ExpressionFactory factory = ExpressionFactory.newInstance();
+        ELContext context = new ELContextImpl();
+
+        TesterBeanB beanB = new TesterBeanB();
+        beanB.setName("Tomcat");
+        ValueExpression var =
+            factory.createValueExpression(beanB, TesterBeanB.class);
+        context.getVariableMapper().setVariable("beanB", var);
+
+        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 });
+        MethodExpression me3 = factory.createMethodExpression(
+                context, "${beanB.sayHello}", String.class,
+                new Class<?>[] { String.class });
+
+        assertEquals("Tomcat", me1.invoke(context, null));
+        assertEquals("Hello JUnit from Tomcat", me2.invoke(context, null));
+        assertEquals("Hello JUnit from Tomcat", me2.invoke(context, new 
Object[] { "JUnit2" }));
+        assertEquals("Hello JUnit2 from Tomcat", me3.invoke(context, new 
Object[] { "JUnit2" }));
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to