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