@Test
public void testGetNextMessage_moreThreads() throws InterruptedException {

    // prepare threads
    int threads = 5;
    final CountDownLatch latch = new CountDownLatch(threads);
    Runnable task = new Runnable() {
        @Override
        public void run() {
            try {
                messagePollExecutor.run();
            } finally {
                latch.countDown();
            }
        }
    };
    mock.expectedMessageCount(3);
    // start processing and waits for result
    for (int i = 0; i < threads; i++) {
        new Thread(task).start();
    }
    latch.await();
    mock.assertIsSatisfied();
    // verify messages
    Message msg = findMessage("1234_4567");
    assertThat(msg, notNullValue());
    assertThat(msg.getState(), is(MsgStateEnum.IN_QUEUE));
    msg = findMessage("1234_4567_8");
    assertThat(msg, notNullValue());
    assertThat(msg.getState(), is(MsgStateEnum.IN_QUEUE));
    msg = findMessage("1234_4567_9");
    assertThat(msg, notNullValue());
    assertThat(msg.getState(), is(MsgStateEnum.IN_QUEUE));
}