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