### Question:
KrazoServletContextListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { ServletContext servletContext = sce.getServletContext(); Set<Class<?>> controllerClasses = (Set<Class<?>>) servletContext.getAttribute(CONTROLLER_CLASSES); if (controllerClasses == null || controllerClasses.isEmpty()) { return; } for (Class<?> controllerClass : controllerClasses) { failIfNoCdiBean(controllerClass); warnIfAnnotatedWithNamed(controllerClass); } } KrazoServletContextListener();  KrazoServletContextListener(BeanManager beanManager); @Override void contextInitialized(ServletContextEvent sce);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void failIfControllerIsNoCdiBean() { BeanManager beanManager = createMock(BeanManager.class); ServletContextEvent event = createMock(ServletContextEvent.class); ServletContext context = createMock(ServletContext.class); KrazoServletContextListener listener = new KrazoServletContextListener(beanManager); Set<Class<?>> controllers = new HashSet<>(singletonList(TestController.class)); expect(event.getServletContext()).andStubReturn(context); expect(context.getAttribute(KrazoContainerInitializer.CONTROLLER_CLASSES)).andStubReturn(controllers); expect(beanManager.getBeans(TestController.class)).andStubReturn(new HashSet<>()); EasyMock.replay(event, context, beanManager); listener.contextInitialized(event); }