Commits

Anonymous committed a7b6e02

Issue number: WW-241
Obtained from:
Submitted by: Fredrik Lindgren
Reviewed by: Cameron Braid
Patch to bring the ServletRedirector retuls test into line with the new implementation

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@33573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits 1dc3df5

Comments (0)

Files changed (1)

src/test/com/opensymphony/webwork/dispatcher/ServletRedirectResultTest.java

 
     public void testAbsoluteRedirect() {
         view.setLocation("/bar/foo.jsp");
+        responseMock.expectAndReturn("encodeRedirectURL", "/context/bar/foo.jsp", "/context/bar/foo.jsp");
+        responseMock.expect("sendRedirect", C.args(C.eq("/context/bar/foo.jsp")));
+
+        try {
+            view.execute(null);
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    public void testPrependServletContextFalse() {
+        view.setLocation("/bar/foo.jsp");
+        view.setPrependServletContext(false);
+        responseMock.expectAndReturn("encodeRedirectURL", "/bar/foo.jsp", "/bar/foo.jsp");
         responseMock.expect("sendRedirect", C.args(C.eq("/bar/foo.jsp")));
 
         try {
 
     public void testRelativeRedirect() {
         view.setLocation("foo.jsp");
-        responseMock.expect("sendRedirect", C.args(C.eq("/context/foo.jsp")));
+        requestMock.expectAndReturn("getServletPath", "/namespace/some.action");
+        responseMock.expectAndReturn("encodeRedirectURL", "/context/namespace/foo.jsp", "/context/namespace/foo.jsp");
+        responseMock.expect("sendRedirect", C.args(C.eq("/context/namespace/foo.jsp")));
 
         try {
             view.execute(null);