SessionServlet extends HttpServlet { @Override protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { Subject subject = SecurityUtils.getSubject(); log.info("Created session for user: {}", subject.getPrincipal()); checkState(subject.isAuthenticated()); checkState(subject.getSession(false) != null); response.setStatus(SC_NO_CONTENT); response.setHeader(X_FRAME_OPTIONS, DENY); }    }
@Test public void testDoPost() throws Exception { underTest.doPost(httpServletRequest, httpServletResponse); verify(httpServletResponse).setHeader(X_FRAME_OPTIONS, "DENY"); }