@Test public void contextInitialized() { // given new Expectations() { { servletContextEvent.getServletContext(); notStrict(); result = servletContext; } }; // when out.contextInitialized(servletContextEvent); // then new Verifications() { { servletContext.setAttribute(Injector.class.getName(), any); } }; }
@Test public void contextDestroyed() { // given new Expectations() { { servletContextEvent.getServletContext(); notStrict(); result = servletContext; } }; // when out.contextDestroyed(servletContextEvent); // then new Verifications() { { servletContext.removeAttribute(Injector.class.getName()); } }; }