use of org.apache.geode.cache.asyncqueue.AsyncEvent in project geode by apache.
the class LuceneEventListenerJUnitTest method shouldThrowAndCaptureIOException.
@Test
public void shouldThrowAndCaptureIOException() throws BucketNotFoundException {
RepositoryManager manager = Mockito.mock(RepositoryManager.class);
Mockito.when(manager.getRepository(any(), any(), any())).thenThrow(IOException.class);
AtomicReference<Throwable> lastException = new AtomicReference<>();
LuceneEventListener.setExceptionObserver(lastException::set);
LuceneEventListener listener = new LuceneEventListener(manager);
AsyncEvent event = Mockito.mock(AsyncEvent.class);
try {
listener.processEvents(Arrays.asList(new AsyncEvent[] { event }));
fail("should have thrown an exception");
} catch (InternalGemFireError expected) {
assertEquals(expected, lastException.get());
}
}
Aggregations