SessionProhibitionHandler implements RequestResponseHandler { @Override public void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain) throws Exception { chain.next(new SessionProhibitionHttpRequestWrapper(request), response); }  @Override void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain);  }
@Test(expected = UnsupportedOperationException.class) public void testGetSessionIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.getSession(); }; handler.handle(request, response, chain(nextHandler)); }
@Test(expected = UnsupportedOperationException.class) public void testGetSessionWithArgIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.getSession(true); }; handler.handle(request, response, chain(nextHandler)); }
@Test(expected = UnsupportedOperationException.class) public void testGetRequestSessionIdIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.getRequestedSessionId(); }; handler.handle(request, response, chain(nextHandler)); }
@Test(expected = UnsupportedOperationException.class) public void testIsRequestedSessionIdValidIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.isRequestedSessionIdValid(); }; handler.handle(request, response, chain(nextHandler)); }
@Test(expected = UnsupportedOperationException.class) public void testIsRequestedSessionIdFromCookieIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.isRequestedSessionIdFromCookie(); }; handler.handle(request, response, chain(nextHandler)); }
@SuppressWarnings("deprecation") @Test(expected = UnsupportedOperationException.class) public void testIsRequestedSessionIdFromUrlIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.isRequestedSessionIdFromUrl(); }; handler.handle(request, response, chain(nextHandler)); }
@Test(expected = UnsupportedOperationException.class) public void testIsRequestedSessionIdFromURLIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.isRequestedSessionIdFromURL(); }; handler.handle(request, response, chain(nextHandler)); }
@Test(expected = UnsupportedOperationException.class) public void testChangeSessionIdIsProhibited() throws Exception { RequestResponseHandler nextHandler = (request, response, chain) -> { request.changeSessionId(); }; handler.handle(request, response, chain(nextHandler)); }