@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."); }
@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/*"); }
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/*"); } }
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/*"); }  }
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); }
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);  }