@Test
public void addEventExecution() {

    String messageId = "some-message-id";
    EventExecution eventExecution = new EventExecution();
    eventExecution.setId("some-id");
    eventExecution.setMessageId(messageId);
    eventExecution.setAction(Type.complete_task);
    eventExecution.setEvent("some-event");
    eventExecution.setStatus(EventExecution.Status.COMPLETED);
    indexDAO.addEventExecution(eventExecution);
    await()
            .atMost(5, TimeUnit.SECONDS)
            .untilAsserted(() -> {
                SearchResponse searchResponse = searchObjectIdsViaExpression(
                        LOG_INDEX_PREFIX + "*",
                        "messageId='" + messageId + "'",
                        0,
                        10000,
                        null,
                        "*",
                        EVENT_DOC_TYPE
                );
                assertTrue("should return 1 or more search results", searchResponse.getHits().getTotalHits() > 0);
                SearchHit searchHit = searchResponse.getHits().getAt(0);
                String resourcePath =
                        String.format("/%s/%s/%s", searchHit.getIndex(), EVENT_DOC_TYPE, searchHit.getId());
                Response response = restClient.performRequest(HttpMethod.GET, resourcePath);
                String responseBody = IOUtils.toString(response.getEntity().getContent());
                TypeReference<HashMap<String, Object>> typeRef =
                        new TypeReference<HashMap<String, Object>>() {
                        };
                Map<String, Object> responseMap = objectMapper.readValue(responseBody, typeRef);
                Map<String, Object> sourceMap = (Map<String, Object>) responseMap.get("_source");
                assertEquals("indexed id should match", "some-id", sourceMap.get("id"));
                assertEquals("indexed message id should match", messageId, sourceMap.get("messageId"));
                assertEquals("indexed action should match", Type.complete_task.name(), sourceMap.get("action"));
                assertEquals("indexed event should match", "some-event", sourceMap.get("event"));
                assertEquals("indexed status should match", EventExecution.Status.COMPLETED.name(), sourceMap.get("status"));
            });
    List<EventExecution> events = indexDAO.getEventExecutions("some-event");
    assertEquals(1, events.size());
    assertEquals(eventExecution, events.get(0));
}