@Test
public void test_timing() {

    createAndSaveMessages(3, (message, order) -> {
        switch (order) {
            case 1:
                message.setState(MsgStateEnum.OK);
                message.setLastUpdateTimestamp(Instant.now().minusSeconds(okSaveTimeInSec + 1));
                break;
            case 2:
                message.setState(MsgStateEnum.OK);
                message.setLastUpdateTimestamp(Instant.now().minusSeconds(okSaveTimeInSec));
                break;
            case 3:
                message.setState(MsgStateEnum.OK);
                // updated too recently, should not be processed yet
                message.setLastUpdateTimestamp(Instant.now());
                break;
        }
    });
    messagesProcessingService.processMessages();
    verify(finalMessageProcessor, times(2)).processMessage(any(Message.class));
    verify(additionalMessageProcessor, times(2)).processMessage(any(Message.class));
}