From c44566bd24ae7d9834eeb0c8019e3bedd779cc1a Mon Sep 17 00:00:00 2001 From: cnenning Date: Fri, 29 Jan 2016 15:12:17 +0100 Subject: [PATCH] fixed jenkins by resolving compiler error in test class (did not appear locally) and adjusting asserts to older version of spring mock objects --- .../json/JSONActionRedirectResultTest.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) 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 c98e41a17..f30555834 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