@Test
public void injectsTheMetricRegistryIntoTheServletContext() {

    final ServletContext context = mock(ServletContext.class);
    final ServletContextEvent event = mock(ServletContextEvent.class);
    when(event.getServletContext()).thenReturn(context);
    listener.contextInitialized(event);
    verify(context).setAttribute("com.codahale.metrics.servlet.InstrumentedFilter.registry", registry);
}