### Question:
MessageHandlerWorker implements Runnable { @Override public void run() { try { messageHandler.handle(message); } catch (final Exception e) { logger.error("Error handling message: " + message, e); } finally { try { pooledMessageListener.completeMessageProcessing(message); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } } } MessageHandlerWorker(final PooledMessageListener<T> pooledMessageListener, final T message,
            final MessageHandler<T> messageHandler); @Override void run();  }### Answer:
@Test public void shouldRun_withMessageAndMessageHandler() throws Exception { final MessageHandlerWorker<TypedMessage> messageHandlingWorker = new MessageHandlerWorker<>( pooledMessageListener, typedMessage, messageHandler); messageHandlingWorker.run(); verify(messageHandler).handle(typedMessage); verify(pooledMessageListener).completeMessageProcessing(typedMessage); }
@Test public void shouldRun_withMessageAndMessageHandlerAndException() throws Exception { doThrow(MessageHandlingException.class).when(messageHandler).handle(any(TypedMessage.class)); final MessageHandlerWorker<TypedMessage> messageHandlingWorker = new MessageHandlerWorker<>( pooledMessageListener, typedMessage, messageHandler); messageHandlingWorker.run(); verify(messageHandler).handle(typedMessage); verify(pooledMessageListener).completeMessageProcessing(typedMessage); }