Return-Path: X-Original-To: apmail-struts-commits-archive@minotaur.apache.org Delivered-To: apmail-struts-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7B032116A5 for ; Wed, 18 Jun 2014 06:49:20 +0000 (UTC) Received: (qmail 79056 invoked by uid 500); 18 Jun 2014 06:49:19 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 78921 invoked by uid 500); 18 Jun 2014 06:49:19 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 78751 invoked by uid 99); 18 Jun 2014 06:49:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jun 2014 06:49:19 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 453CE83B33C; Wed, 18 Jun 2014 06:49:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lukaszlenart@apache.org To: commits@struts.apache.org Date: Wed, 18 Jun 2014 06:49:23 -0000 Message-Id: In-Reply-To: <20bec4e476d24a2e80ce3caab9f07683@git.apache.org> References: <20bec4e476d24a2e80ce3caab9f07683@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/50] git commit: Updates tests as using Object's methods is prohibited Updates tests as using Object's methods is prohibited Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/5d8aa8a8 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/5d8aa8a8 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/5d8aa8a8 Branch: refs/heads/develop Commit: 5d8aa8a80be131dbcf412c28aec0435d3bdc23e3 Parents: bcc0327 Author: Lukasz Lenart Authored: Sat Apr 26 06:59:18 2014 +0200 Committer: Lukasz Lenart Committed: Sat Apr 26 06:59:18 2014 +0200 ---------------------------------------------------------------------- .../ExecuteAndWaitInterceptorTest.java | 2 ++ .../struts2/views/jsp/PropertyTagTest.java | 30 ++++++++++++-------- .../apache/struts2/views/jsp/ui/SelectTest.java | 2 +- .../struts2/rest/RestActionInvocationTest.java | 2 ++ .../xwork2/DefaultActionInvocationTest.java | 8 ++++++ 5 files changed, 31 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/5d8aa8a8/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java index 01d1a6e..5a01015 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java @@ -32,6 +32,7 @@ import com.opensymphony.xwork2.config.entities.ResultConfig; import com.opensymphony.xwork2.inject.ContainerBuilder; import com.opensymphony.xwork2.interceptor.ParametersInterceptor; import com.opensymphony.xwork2.mock.MockResult; +import com.opensymphony.xwork2.ognl.OgnlUtil; import com.opensymphony.xwork2.util.location.LocatableProperties; import org.apache.struts2.ServletActionContext; import org.apache.struts2.StrutsInternalTestCase; @@ -222,6 +223,7 @@ public class ExecuteAndWaitInterceptorTest extends StrutsInternalTestCase { public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException { builder.factory(ObjectFactory.class); builder.factory(ActionProxyFactory.class, DefaultActionProxyFactory.class); + builder.factory(OgnlUtil.class, OgnlUtil.class); } } http://git-wip-us.apache.org/repos/asf/struts/blob/5d8aa8a8/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java index cce9a0c..a2b77ba 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java @@ -180,11 +180,13 @@ public class PropertyTagTest extends StrutsInternalTestCase { pageContext.setRequest(request); // test - {PropertyTag tag = new PropertyTag(); - tag.setPageContext(pageContext); - tag.setValue("%{toString()}"); - tag.doStartTag(); - tag.doEndTag();} + { + PropertyTag tag = new PropertyTag(); + tag.setPageContext(pageContext); + tag.setValue("%{formatTitle()}"); + tag.doStartTag(); + tag.doEndTag(); + } // verify test request.verify(); @@ -212,7 +214,7 @@ public class PropertyTagTest extends StrutsInternalTestCase { tag.setEscape(false); tag.setEscapeJavaScript(true); tag.setPageContext(pageContext); - tag.setValue("%{toString()}"); + tag.setValue("%{formatTitle()}"); tag.doStartTag(); tag.doEndTag();} @@ -242,7 +244,7 @@ public class PropertyTagTest extends StrutsInternalTestCase { tag.setEscape(false); tag.setEscapeXml(true); tag.setPageContext(pageContext); - tag.setValue("%{toString()}"); + tag.setValue("%{formatTitle()}"); tag.doStartTag(); tag.doEndTag();} @@ -272,7 +274,7 @@ public class PropertyTagTest extends StrutsInternalTestCase { tag.setEscape(false); tag.setEscapeCsv(true); tag.setPageContext(pageContext); - tag.setValue("%{toString()}"); + tag.setValue("%{formatTitle()}"); tag.doStartTag(); tag.doEndTag();} @@ -300,7 +302,7 @@ public class PropertyTagTest extends StrutsInternalTestCase { // test {PropertyTag tag = new PropertyTag(); tag.setPageContext(pageContext); - tag.setValue("toString()"); + tag.setValue("formatTitle()"); tag.doStartTag(); tag.doEndTag();} @@ -328,7 +330,7 @@ public class PropertyTagTest extends StrutsInternalTestCase { // test {PropertyTag tag = new PropertyTag(); tag.setPageContext(pageContext); - tag.setValue("toString()"); + tag.setValue("formatTitle()"); tag.doStartTag(); tag.doEndTag();} @@ -356,7 +358,7 @@ public class PropertyTagTest extends StrutsInternalTestCase { // test {PropertyTag tag = new PropertyTag(); tag.setPageContext(pageContext); - tag.setValue("%{toString()}"); + tag.setValue("%{formatTitle()}"); tag.doStartTag(); tag.doEndTag();} @@ -385,8 +387,12 @@ public class PropertyTagTest extends StrutsInternalTestCase { return title; } - public String toString() { + public String formatTitle() { return "Foo is: " + title; } + + public String toString() { + return formatTitle(); + } } } http://git-wip-us.apache.org/repos/asf/struts/blob/5d8aa8a8/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java index 094cfc9..06b7e80 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java @@ -494,7 +494,7 @@ public class SelectTest extends AbstractUITagTest { tag.setList("list2"); tag.setListKey("id"); tag.setListValue("name"); - tag.setValue("fooInt.toString()"); + tag.setValue("fooInt"); // header stuff tag.setHeaderKey("headerKey"); http://git-wip-us.apache.org/repos/asf/struts/blob/5d8aa8a8/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionInvocationTest.java ---------------------------------------------------------------------- diff --git a/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionInvocationTest.java b/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionInvocationTest.java index af2a7fd..6db05f1 100644 --- a/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionInvocationTest.java +++ b/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionInvocationTest.java @@ -10,6 +10,7 @@ import com.opensymphony.xwork2.config.entities.InterceptorMapping; import com.opensymphony.xwork2.config.entities.ResultConfig; import com.opensymphony.xwork2.mock.MockActionProxy; import com.opensymphony.xwork2.mock.MockInterceptor; +import com.opensymphony.xwork2.ognl.OgnlUtil; import com.opensymphony.xwork2.util.XWorkTestCaseHelper; import junit.framework.TestCase; import org.apache.struts2.ServletActionContext; @@ -228,6 +229,7 @@ public class RestActionInvocationTest extends TestCase { request.setMethod("GET"); + restActionInvocation.setOgnlUtil(new OgnlUtil()); restActionInvocation.invoke(); assertEquals(123, response.getStatus()); http://git-wip-us.apache.org/repos/asf/struts/blob/5d8aa8a8/xwork-core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java ---------------------------------------------------------------------- diff --git a/xwork-core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java b/xwork-core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java index 1b93a5c..e0aa8ba 100644 --- a/xwork-core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java +++ b/xwork-core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java @@ -1,9 +1,14 @@ package com.opensymphony.xwork2; +import com.mockobjects.dynamic.Mock; import com.opensymphony.xwork2.config.entities.InterceptorMapping; import com.opensymphony.xwork2.mock.MockActionProxy; import com.opensymphony.xwork2.mock.MockContainer; import com.opensymphony.xwork2.mock.MockInterceptor; +import com.opensymphony.xwork2.ognl.OgnlUtil; +import com.opensymphony.xwork2.util.ValueStackFactory; +import org.easymock.EasyMock; +import org.easymock.IMocksControl; import java.util.ArrayList; import java.util.HashMap; @@ -39,6 +44,9 @@ public class DefaultActionInvocationTest extends XWorkTestCase { mockInterceptor3.setExpectedFoo("test3"); DefaultActionInvocation defaultActionInvocation = new DefaultActionInvocationTester(interceptorMappings); + container.inject(defaultActionInvocation); + defaultActionInvocation.stack = container.getInstance(ValueStackFactory.class).createValueStack(); + defaultActionInvocation.invoke(); assertTrue(mockInterceptor1.isExecuted()); assertTrue(mockInterceptor2.isExecuted());