private Servlet instantiateServlet(final Class<? extends HttpServlet> serverClass) throws ServletInitializationException { try { return serverClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ServletInitializationException(e); } }
@Test(expected = UnexpectedSituationException.class) public void shouldWrapServletInitializationException() throws IOException, ServletException, ServletInitializationException { when(servletContainer.getServletForClass(any(Class.class), any(ServletConfig.class))) .thenThrow(new ServletInitializationException(new Exception())); servletResourceProvider.load("/", request, response); } }