@Test public void deliverShouldNotPropagateException() throws Exception { MailboxListener.Event event = new MailboxListener.Event(new MockMailboxSession("test"), null) {}; doThrow(new RuntimeException()).when(mailboxListener).event(event); asynchronousEventDelivery.deliver(mailboxListener, event); verify(mailboxListener, timeout(ONE_MINUTE)).event(event); }
@Test public void deliverShouldWorkWhenThePoolIsFull() throws Exception { MailboxListener.Event event = new MailboxListener.Event(new MockMailboxSession("test"), null) {}; int operationCount = 10; for (int i = 0; i < operationCount; i++) { asynchronousEventDelivery.deliver(mailboxListener, event); } verify(mailboxListener, timeout(ONE_MINUTE).times(operationCount)).event(event); }
@Test public void deliverShouldWork() throws Exception { MailboxListener.Event event = new MailboxListener.Event(null, null) {}; asynchronousEventDelivery.deliver(mailboxListener, event); verify(mailboxListener, timeout(ONE_MINUTE)).event(event); }
@After public void tearDown() { asynchronousEventDelivery.stop(); }