@Test public void getWebServer_callsInitializers() { ServerlessServletEmbeddedServerFactory factory = new ServerlessServletEmbeddedServerFactory(); factory.getWebServer(new ServletContextInitializer() { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (servletContext == null) { fail("Null servlet context"); } } }); }
@Override public WebServer getWebServer(ServletContextInitializer... initializers) { this.initializers = initializers; for (ServletContextInitializer i : initializers) { try { if (handler.getServletContext() == null) { throw new WebServerException("Attempting to initialize ServletEmbeddedWebServer without ServletContext in Handler", null); } i.onStartup(handler.getServletContext()); } catch (ServletException e) { throw new WebServerException("Could not initialize Servlets", e); } } return this; }
ServerlessServletEmbeddedServerFactory implements ServletWebServerFactory, WebServer { @Override public WebServer getWebServer(ServletContextInitializer... initializers) { this.initializers = initializers; for (ServletContextInitializer i : initializers) { try { if (handler.getServletContext() == null) { throw new WebServerException("Attempting to initialize ServletEmbeddedWebServer without ServletContext in Handler", null); } i.onStartup(handler.getServletContext()); } catch (ServletException e) { throw new WebServerException("Could not initialize Servlets", e); } } return this; } }
ServerlessServletEmbeddedServerFactory implements ServletWebServerFactory, WebServer { @Override public WebServer getWebServer(ServletContextInitializer... initializers) { this.initializers = initializers; for (ServletContextInitializer i : initializers) { try { if (handler.getServletContext() == null) { throw new WebServerException("Attempting to initialize ServletEmbeddedWebServer without ServletContext in Handler", null); } i.onStartup(handler.getServletContext()); } catch (ServletException e) { throw new WebServerException("Could not initialize Servlets", e); } } return this; } ServerlessServletEmbeddedServerFactory(); }
ServerlessServletEmbeddedServerFactory implements ServletWebServerFactory, WebServer { @Override public WebServer getWebServer(ServletContextInitializer... initializers) { this.initializers = initializers; for (ServletContextInitializer i : initializers) { try { if (handler.getServletContext() == null) { throw new WebServerException("Attempting to initialize ServletEmbeddedWebServer without ServletContext in Handler", null); } i.onStartup(handler.getServletContext()); } catch (ServletException e) { throw new WebServerException("Could not initialize Servlets", e); } } return this; } ServerlessServletEmbeddedServerFactory(); @Override WebServer getWebServer(ServletContextInitializer... initializers); @Override void start(); @Override void stop(); @Override int getPort(); }
ServerlessServletEmbeddedServerFactory implements ServletWebServerFactory, WebServer { @Override public WebServer getWebServer(ServletContextInitializer... initializers) { this.initializers = initializers; for (ServletContextInitializer i : initializers) { try { if (handler.getServletContext() == null) { throw new WebServerException("Attempting to initialize ServletEmbeddedWebServer without ServletContext in Handler", null); } i.onStartup(handler.getServletContext()); } catch (ServletException e) { throw new WebServerException("Could not initialize Servlets", e); } } return this; } ServerlessServletEmbeddedServerFactory(); @Override WebServer getWebServer(ServletContextInitializer... initializers); @Override void start(); @Override void stop(); @Override int getPort();  }