HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
when(webRequest.getContainerRequest()).thenReturn(httpServletRequest);
when(httpServletRequest.getCharacterEncoding()).thenReturn("UTF-8");
HttpServletResponse httpServletResponse = mock(HttpServletResponse.class);
when(httpServletResponse.encodeRedirectURL(Matchers.anyString())).thenReturn(url);
StringWriter writer = new StringWriter();
when(httpServletResponse.getWriter()).thenReturn(new PrintWriter(writer));
ServletWebResponse webResponse = new ServletWebResponse(webRequest, httpServletResponse);
webResponse.sendRedirect(url);