@Test
  public void shouldHandleCacheClosedException()
      throws BucketNotFoundException {
    Mockito.when(manager.getRepository(any(), any(), any()))
        .thenThrow(CacheClosedException.class);

    AsyncEvent event = Mockito.mock(AsyncEvent.class);
    boolean result = listener.processEvents(Arrays.asList(event));
    assertFalse(result);
    verify(listener, times(1))
        .logDebugMessage(contains("cache has been closed"), any(CacheClosedException.class));
  }
Unit test that async event listener dispatched the events to the appropriate repository.
geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java