SessionHelpers { public ServletResponse prepareResponse(ServletRequest request, ServletResponse response) { if (request instanceof HttpRequestWrapper) { return ((HttpRequestWrapper)request).getResponse(); } return response; }  ServletRequest prepareRequest(ServletRequest request, ServletResponse response,
      ServletContext originalServletContext); ServletResponse prepareResponse(ServletRequest request, ServletResponse response); MethodHandle[] initSessionManagement(ServletContext servletContext); MethodHandle[] initSessionManagement(ServletContext servletContext, boolean reset); void commitRequest(ServletRequest request, ServletRequest oldRequest); @SuppressWarnings("unchecked") void interceptHttpListener(EventListener caller, HttpSessionEvent event); void onAddListener(ServletContext servletContext, Object listener);  }
@Test public void testPrepareResponse() { ServletResponse response = mock(ServletResponse.class); HttpResponseWrapper responseWrapped = mock(HttpResponseWrapper.class); HttpRequestWrapper request = mock(HttpRequestWrapper.class); when(request.getServletContext()).thenReturn(servletContext); when(request.getResponse()).thenReturn(responseWrapped); ServletResponse result = SessionHelpersFacade.prepareResponse(request , response, null); assertSame(responseWrapped, result); }