ServerWebApp extends Server implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent event) { try { init(); } catch (ServerException ex) { event.getServletContext().log("ERROR: " + ex.getMessage()); throw new RuntimeException(ex); } } protected  ServerWebApp(String name, String homeDir, String configDir,
      String logDir, String tempDir, Configuration config); protected  ServerWebApp(String name, String homeDir, Configuration config);  ServerWebApp(String name); static void setHomeDirForCurrentThread(String homeDir); @Override void contextInitialized(ServletContextEvent event); @Override void contextDestroyed(ServletContextEvent event); InetSocketAddress getAuthority(); @VisibleForTesting void setAuthority(InetSocketAddress authority); boolean isSslEnabled(); static final String SSL_ENABLED; }
@Test(expected = RuntimeException.class) @TestDir public void failedInit() throws Exception { String dir = TestDirHelper.getTestDir().getAbsolutePath(); System.setProperty("TestServerWebApp2.home.dir", dir); System.setProperty("TestServerWebApp2.config.dir", dir); System.setProperty("TestServerWebApp2.log.dir", dir); System.setProperty("TestServerWebApp2.temp.dir", dir); System.setProperty("testserverwebapp2.services", "FOO"); ServerWebApp server = new ServerWebApp("TestServerWebApp2") { }; server.contextInitialized(null); }