### Question:
GuiceBindingSpringContextLoaderListener extends ContextLoaderListener { @Override public void contextInitialized(ServletContextEvent event) { super.contextInitialized(event); ServletContext servletContext = event.getServletContext(); Collection<Module> modules = getModulesFromApplicationContext(); overrideInjector(Guice.createInjector(modules), servletContext); }  @Override void contextInitialized(ServletContextEvent event); @Override void contextDestroyed(ServletContextEvent event);  }### Answer:
@Test public void initialize_test() { Injector injector = Guice.createInjector(createNiceMock(Module.class)); MockServletContext mockServletContext = new MockServletContext(); mockServletContext.addInitParameter("contextConfigLocation", "classpath:rave-shindig-test-applicationContext.xml, classpath:rave-shindig-test-dataContext.xml"); mockServletContext.setAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE, injector); GuiceBindingSpringContextLoaderListener listener = new GuiceBindingSpringContextLoaderListener(); ServletContextEvent event = createNiceMock(ServletContextEvent.class); expect(event.getServletContext()).andReturn(mockServletContext).anyTimes(); replay(event); listener.contextInitialized(event); assertThat((Injector)mockServletContext.getAttribute(GuiceServletContextListener.INJECTOR_ATTRIBUTE), is(not(sameInstance(injector)))); }