Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 63477 invoked from network); 4 Apr 2010 10:08:27 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Apr 2010 10:08:27 -0000 Received: (qmail 33040 invoked by uid 500); 4 Apr 2010 10:08:27 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 32871 invoked by uid 500); 4 Apr 2010 10:08:26 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 32862 invoked by uid 99); 4 Apr 2010 10:08:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Apr 2010 10:08:26 +0000 X-ASF-Spam-Status: No, hits=-1114.1 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Apr 2010 10:08:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 19C0123888CC; Sun, 4 Apr 2010 10:08:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r930652 - /tomcat/trunk/test/org/apache/el/TestMethodExpressionImpl.java Date: Sun, 04 Apr 2010 10:08:05 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100404100805.19C0123888CC@eris.apache.org> 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-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org