ActionLogMessageHandler implements BulkMessageHandler<ActionLogMessage> { @Override public void handle(List<Message<ActionLogMessage>> messages) { List<ActionLogMessage> actionLogs = new ArrayList<>(messages.size()); for (Message<ActionLogMessage> message : messages) { actionLogs.add(message.value); } actionService.index(actionLogs); }  @Override void handle(List<Message<ActionLogMessage>> messages);  }
@Test void handle() { List<Message<ActionLogMessage>> messages = List.of(new Message<>("k1", new ActionLogMessage()), new Message<>("k1", new ActionLogMessage())); handler.handle(messages); verify(actionService).index(argThat((List<ActionLogMessage> values) -> values.size() == 2)); }