fix tests

Project: http://git-wip-us.apache.org/repos/asf/struts-archetypes/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-archetypes/commit/de51ed9a
Tree: http://git-wip-us.apache.org/repos/asf/struts-archetypes/tree/de51ed9a
Diff: http://git-wip-us.apache.org/repos/asf/struts-archetypes/diff/de51ed9a

Branch: refs/heads/master
Commit: de51ed9a9fb6e191c76b82634094680af14e948e
Parents: 7cfced2
Author: Aleksandr Mashchenko <[email protected]>
Authored: Fri Jul 14 20:11:44 2017 +0300
Committer: Aleksandr Mashchenko <[email protected]>
Committed: Fri Jul 14 20:11:44 2017 +0300

----------------------------------------------------------------------
 .../src/test/java/example/HelloWorldTest.java                   | 2 ++
 .../src/test/java/actions/HelloActionTest.java                  | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/de51ed9a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java
----------------------------------------------------------------------
diff --git 
a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java
 
b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java
index 28c0a4d..27397a9 100644
--- 
a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java
+++ 
b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java
@@ -21,6 +21,7 @@
 
 package ${package}.example;
 
+import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionSupport;
 import org.apache.struts2.StrutsTestCase;
 
@@ -28,6 +29,7 @@ public class HelloWorldTest extends StrutsTestCase {
 
     public void testHelloWorld() throws Exception {
         HelloWorld hello_world = container.inject(HelloWorld.class);
+        ActionContext.getContext().getContainer().inject(hello_world);
         String result = hello_world.execute();
         assertTrue("Expected a success result!",
                 ActionSupport.SUCCESS.equals(result));

http://git-wip-us.apache.org/repos/asf/struts-archetypes/blob/de51ed9a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java
----------------------------------------------------------------------
diff --git 
a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java
 
b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java
index 91c508e..8b83735 100644
--- 
a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java
+++ 
b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java
@@ -1,12 +1,15 @@
 package ${package}.actions;
 
-import com.opensymphony.xwork2.ActionSupport;
 import org.apache.struts2.StrutsTestCase;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionSupport;
+
 public class HelloActionTest extends StrutsTestCase {
 
     public void testHelloAction() throws Exception {
         HelloAction hello = new HelloAction();
+        ActionContext.getContext().getContainer().inject(hello);
         String result = hello.execute();
         assertTrue("Expected a success result!",
                 ActionSupport.SUCCESS.equals(result));

Reply via email to