### Question:
ServicesConfigurationContextListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { MemAddressBook addressBook = new MemAddressBook(); addressBook.setIdGenerator(new UUIDIdGenerator()); sce.getServletContext().setAttribute("globalAddressBook", addressBook); }  @Override void contextInitialized(ServletContextEvent sce); @Override void contextDestroyed(ServletContextEvent sce);  }### Answer:
@Test public void testContextInitialized() { ServicesConfigurationContextListener listener = new ServicesConfigurationContextListener(); ServletContextEvent sce = mock(ServletContextEvent.class); ServletContext context = mock(ServletContext.class); when(sce.getServletContext()).thenReturn(context); listener.contextInitialized(sce); verify(context).setAttribute(eq("globalAddressBook"), isA(GlobalAddressBook.class)); }