StatService { public void index(List<StatMessage> messages) { index(messages, LocalDate.now()); }  void index(List<StatMessage> messages); void index(StatMessage message);  }
@Test void index() { StatMessage message = message("1"); message.info = Map.of("key", "value"); var now = LocalDate.of(2017, Month.OCTOBER, 10); statService.index(List.of(message), now); StatDocument stat = statDocument(now, message.id); assertThat(stat.stats).isEqualTo(message.stats); assertThat(stat.info).isEqualTo(message.info); }
@Test void bulkIndex() { List<StatMessage> messages = Lists.newArrayList(); for (int i = 0; i < 6; i++) { messages.add(message("bulk-" + i)); } var now = LocalDate.of(2017, Month.OCTOBER, 10); statService.index(messages, now); StatDocument stat = statDocument(now, messages.get(0).id); assertThat(stat.stats).isEqualTo(messages.get(0).stats); }