@Test
public void testInterceptHttpListenerAlreadyIntercepted() {

  EventListener caller = mock(EventListener.class);
  HttpSessionEvent event = mock(HttpSessionEvent.class);
  @SuppressWarnings("unchecked")
  Set<Object> listenerSet = mock(Set.class);
  // Let's assume we intercepted the caller
  listenerSet.add(caller);
  HttpSession session = mock(RepositoryBackedHttpSession.class);
  when(session.getServletContext()).thenReturn(servletContext);
  when(servletContext.getAttribute(SessionHelpers.INTROSPECTING_LISTENERS)).thenReturn(listenerSet);
  when(event.getSession()).thenReturn(session);
  sessionHelpers.interceptHttpListener(caller, event);
  // Called only once - in this method, not in interceptHttpListener
  verify(listenerSet, times(1)).add(caller);
}