Repository: struts Updated Branches: refs/heads/support-2-3 2a6acabe5 -> c44566bd2
fixed jenkins by resolving compiler error in test class (did not appear locally) and adjusting asserts to older version of spring mock objects Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/c44566bd Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/c44566bd Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/c44566bd Branch: refs/heads/support-2-3 Commit: c44566bd24ae7d9834eeb0c8019e3bedd779cc1a Parents: 2a6acab Author: cnenning <cnenn...@apache.org> Authored: Fri Jan 29 15:12:17 2016 +0100 Committer: cnenning <cnenn...@apache.org> Committed: Fri Jan 29 15:12:17 2016 +0100 ---------------------------------------------------------------------- .../json/JSONActionRedirectResultTest.java | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/c44566bd/plugins/json/src/test/java/org/apache/struts2/json/JSONActionRedirectResultTest.java ---------------------------------------------------------------------- diff --git a/plugins/json/src/test/java/org/apache/struts2/json/JSONActionRedirectResultTest.java b/plugins/json/src/test/java/org/apache/struts2/json/JSONActionRedirectResultTest.java index c98e41a..f305558 100644 --- a/plugins/json/src/test/java/org/apache/struts2/json/JSONActionRedirectResultTest.java +++ b/plugins/json/src/test/java/org/apache/struts2/json/JSONActionRedirectResultTest.java @@ -37,13 +37,17 @@ public class JSONActionRedirectResultTest extends StrutsTestCase { String content = response.getContentAsString(); assertEquals("", content); - String location = response.getHeader("Location"); - assertEquals("/targetAction.action", location); - assertEquals(302, response.getStatus()); + + // spring MockHttpServletResponse does not set Location-Header and status code on sendRedirect() +// String location = response.getHeader("Location").toString(); +// assertEquals("/targetAction.action", location); +// assertEquals(302, response.getStatus()); + String redirectedUrl = response.getRedirectedUrl(); + assertEquals("/targetAction.action", redirectedUrl); } public void testJsonRedirect() throws Exception { - JSONActionRedirectResult result = new JSONActionRedirectResult(); + JSONActionRedirectResult result = new JSONActionRedirectResult(); result.setActionName("targetAction"); result.setActionMapper(new DefaultActionMapper()); result.setUrlHelper(new DefaultUrlHelper()); @@ -79,9 +83,13 @@ public class JSONActionRedirectResultTest extends StrutsTestCase { String content = response.getContentAsString(); assertEquals("", content); - String location = response.getHeader("Location"); - assertEquals("/targetAction.action", location); - assertEquals(302, response.getStatus()); + + // spring MockHttpServletResponse does not set Location-Header and status code on sendRedirect() +// String location = response.getHeader("Location").toString(); +// assertEquals("/targetAction.action", location); +// assertEquals(302, response.getStatus()); + String redirectedUrl = response.getRedirectedUrl(); + assertEquals("/targetAction.action", redirectedUrl); } @Override