@Test public void testOnStartup() throws ServletException { ServletContext mockedServletContext = mock(ServletContext.class); lsci.onStartup(null, mockedServletContext); verify(mockedServletContext).addListener(any(LogbackServletContextListener.class)); }
@Override public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException { if (isDisabledByConfiguration(ctx)) { StatusViaSLF4JLoggerFactory.addInfo("Due to deployment instructions will NOT register an instance of " + LogbackServletContextListener.class + " to the current web-app", this); return; } StatusViaSLF4JLoggerFactory.addInfo("Adding an instance of " + LogbackServletContextListener.class + " to the current web-app", this); LogbackServletContextListener lscl = new LogbackServletContextListener(); ctx.addListener(lscl); }
LogbackServletContainerInitializer implements ServletContainerInitializer { @Override public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException { if (isDisabledByConfiguration(ctx)) { StatusViaSLF4JLoggerFactory.addInfo("Due to deployment instructions will NOT register an instance of " + LogbackServletContextListener.class + " to the current web-app", this); return; } StatusViaSLF4JLoggerFactory.addInfo("Adding an instance of " + LogbackServletContextListener.class + " to the current web-app", this); LogbackServletContextListener lscl = new LogbackServletContextListener(); ctx.addListener(lscl); } }
LogbackServletContainerInitializer implements ServletContainerInitializer { @Override public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException { if (isDisabledByConfiguration(ctx)) { StatusViaSLF4JLoggerFactory.addInfo("Due to deployment instructions will NOT register an instance of " + LogbackServletContextListener.class + " to the current web-app", this); return; } StatusViaSLF4JLoggerFactory.addInfo("Adding an instance of " + LogbackServletContextListener.class + " to the current web-app", this); LogbackServletContextListener lscl = new LogbackServletContextListener(); ctx.addListener(lscl); }  }
LogbackServletContainerInitializer implements ServletContainerInitializer { @Override public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException { if (isDisabledByConfiguration(ctx)) { StatusViaSLF4JLoggerFactory.addInfo("Due to deployment instructions will NOT register an instance of " + LogbackServletContextListener.class + " to the current web-app", this); return; } StatusViaSLF4JLoggerFactory.addInfo("Adding an instance of " + LogbackServletContextListener.class + " to the current web-app", this); LogbackServletContextListener lscl = new LogbackServletContextListener(); ctx.addListener(lscl); }  @Override void onStartup(Set<Class<?>> c, ServletContext ctx); }
LogbackServletContainerInitializer implements ServletContainerInitializer { @Override public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException { if (isDisabledByConfiguration(ctx)) { StatusViaSLF4JLoggerFactory.addInfo("Due to deployment instructions will NOT register an instance of " + LogbackServletContextListener.class + " to the current web-app", this); return; } StatusViaSLF4JLoggerFactory.addInfo("Adding an instance of " + LogbackServletContextListener.class + " to the current web-app", this); LogbackServletContextListener lscl = new LogbackServletContextListener(); ctx.addListener(lscl); }  @Override void onStartup(Set<Class<?>> c, ServletContext ctx);  }