WebConfig implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(PAPRestConfig.class); ctx.setServletContext(container); ctx.refresh(); ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(ctx)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/onap/*"); }  @Override void onStartup(ServletContext container);  }
@Test(expected = NullPointerException.class) public void testNegativeStartup() throws ServletException { WebConfig init = new WebConfig(); ServletContext container = Mockito.mock(ServletContext.class); init.onStartup(container); fail("Expecting an exception."); }