private void testRedirection(String requestPath, String resourcePath, String redirect, String expected)
throws Exception {
RedirectServletResponse resp = new RedirectServletResponse();
SlingHttpServletRequest request = new RedirectServletRequest(redirect, requestPath);
PostResponse htmlResponse = new HtmlResponse();
htmlResponse.setPath(resourcePath);
assertEquals(expected != null, servlet.redirectIfNeeded(request, htmlResponse, resp));
assertEquals(expected, resp.redirectLocation);
}