DevModeInitializer implements ClassLoaderAwareServletContainerInitializer, Serializable,
        ServletContextListener { @Override public void process(Set<Class<?>> classes, ServletContext context) throws ServletException { Collection<? extends ServletRegistration> registrations = context .getServletRegistrations().values(); ServletRegistration vaadinServletRegistration = null; for (ServletRegistration registration : registrations) { if (registration.getClassName() != null && isVaadinServletSubClass(registration.getClassName())) { vaadinServletRegistration = registration; break; } } DeploymentConfiguration config; if (vaadinServletRegistration != null) { config = StubServletConfig.createDeploymentConfiguration(context, vaadinServletRegistration, VaadinServlet.class); } else { config = StubServletConfig.createDeploymentConfiguration(context, VaadinServlet.class); } initDevModeHandler(classes, context, config); setDevModeStarted(context); }  @Override void process(Set<Class<?>> classes, ServletContext context); static void initDevModeHandler(Set<Class<?>> classes,
            ServletContext context, DeploymentConfiguration config); static boolean isDevModeAlreadyStarted(
            ServletContext servletContext); @Override void contextInitialized(ServletContextEvent ctx); @Override void contextDestroyed(ServletContextEvent ctx);  }
@Test public void should_Run_Updaters_doesNotThrow() throws Exception { process(); }
@Test public void should_Run_Updaters_when_NoNodeConfFiles_doesNotThrow() throws Exception { webpackFile.delete(); mainPackageFile.delete(); process(); }
@Test public void should_Run_Updaters_when_NoNodeConfFiles() throws Exception { webpackFile.delete(); mainPackageFile.delete(); process(); assertNotNull(DevModeHandler.getDevModeHandler()); }
@Test public void should_Run_Updaters_when_NoAppPackageFile() throws Exception { process(); assertNotNull(DevModeHandler.getDevModeHandler()); }
@Test public void should_Run_Updaters_when_NoWebpackFile() throws Exception { webpackFile.delete(); process(); assertNotNull(DevModeHandler.getDevModeHandler()); }
@Test public void should_Not_AddContextListener() throws Exception { ArgumentCaptor<? extends EventListener> arg = ArgumentCaptor .forClass(EventListener.class); process(); Mockito.verify(servletContext, Mockito.never()) .addListener(arg.capture()); }
@Test public void listener_should_stopDevModeHandler_onDestroy() throws Exception { initParams.put(SERVLET_PARAMETER_REUSE_DEV_SERVER, "false"); process(); assertNotNull(DevModeHandler.getDevModeHandler()); runDestroy(); assertNull(DevModeHandler.getDevModeHandler()); }