EverrestInitializedListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { ServletContext servletContext = sce.getServletContext(); EverrestServletContextInitializer initializer = new EverrestServletContextInitializer(servletContext); initializeEverrestComponents(initializer, servletContext); }  @Override void contextDestroyed(ServletContextEvent sce); @Override void contextInitialized(ServletContextEvent sce);  }
@Test public void setsEverrestComponentsAsServletContextAttributeWhenServletContextInitialized() { EverrestInitializedListener everrestInitializedListener = new EverrestInitializedListener(); ServletContextEvent servletContextEvent = new ServletContextEvent(servletContext); everrestInitializedListener.contextInitialized(servletContextEvent); verify(servletContext).setAttribute(eq(EverrestProcessor.class.getName()), isA(EverrestProcessor.class)); verify(servletContext).setAttribute(eq(EverrestConfiguration.class.getName()), isA(EverrestConfiguration.class)); verify(servletContext).setAttribute(eq(Application.class.getName()), isA(EverrestApplication.class)); verify(servletContext).setAttribute(eq(ApplicationProviderBinder.class.getName()), isA(ProviderBinder.class)); verify(servletContext).setAttribute(eq(ResourceBinder.class.getName()), isA(ResourceBinder.class)); verify(servletContext).setAttribute(eq(DependencySupplier.class.getName()), isA(DependencySupplier.class)); }