EventService { public void index(List<EventMessage> messages) { index(messages, LocalDate.now()); }  void index(List<EventMessage> messages);  }
@Test void index() { EventMessage message = message("1"); message.info = Map.of("param", "value"); var now = LocalDate.of(2019, Month.MARCH, 19); eventService.index(List.of(message), now); EventDocument event = eventDocument(now, message.id); assertThat(event.context).isEqualTo(message.context); assertThat(event.info).containsEntry("param", "value"); }
@Test void bulkIndex() { List<EventMessage> messages = Lists.newArrayList(); for (int i = 0; i < 6; i++) { messages.add(message("bulk-" + i)); } var now = LocalDate.of(2019, Month.MARCH, 19); eventService.index(messages, now); EventDocument event = eventDocument(now, messages.get(0).id); assertThat(event.context).isEqualTo(messages.get(0).context); }