### Question:
BonitaExportServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { OutputStream out = null; try { final byte[] resourceBytes = exportResources(request); setResponseHeaders(request, response); out = response.getOutputStream(); out.write(resourceBytes); out.flush(); } catch (final InvalidSessionException e) { String message = "Session expired. Please log in again."; if (getLogger().isLoggable(Level.FINE)) { getLogger().log(Level.FINE, message, e); } response.sendError(HttpServletResponse.SC_UNAUTHORIZED, message); } catch (final FileNotFoundException e) { String message = "There is no BDM Access control installed."; if (getLogger().isLoggable(Level.INFO)) { getLogger().log(Level.INFO, message); } response.sendError(HttpServletResponse.SC_NOT_FOUND, message); } catch (final Exception e) { if (getLogger().isLoggable(Level.SEVERE)) { getLogger().log(Level.SEVERE, e.getMessage(), e); } throw new ServletException(e.getMessage(), e); } finally { try { if (out != null) { out.close(); } } catch (final IOException e) { getLogger().log(Level.SEVERE, e.getMessage(), e); } } }    }### Answer:
@Test(expected = ServletException.class) public void should_do_get_without_session_return_servlet_exception() throws Exception { given(hsRequest.getSession()).willReturn(httpSession); given(httpSession.getAttribute("apiSession")).willReturn(null); spiedApplicationsExportServlet.doGet(hsRequest, hsResponse); }