@Test
public void addMessage() {

	String messageId = "some-message-id";
	Message message = new Message();
	message.setId(messageId);
	message.setPayload("some-payload");
	message.setReceipt("some-receipt");
	indexDAO.addMessage("some-queue", message);
	await()
		.atMost(5, TimeUnit.SECONDS)
		.untilAsserted(() -> {
               SearchResponse searchResponse = search(
                   LOG_INDEX_PREFIX + "*",
                   "messageId='" + messageId + "'",
                   0,
                   10000,
                   "*",
                   MSG_DOC_TYPE
               );
			assertEquals("search results should be length 1", searchResponse.getHits().getTotalHits(), 1);
               SearchHit searchHit = searchResponse.getHits().getAt(0);
			GetResponse response = elasticSearchClient
                   .prepareGet(searchHit.getIndex(), MSG_DOC_TYPE, searchHit.getId())
                   .get();
			assertEquals("indexed message id should match", messageId, response.getSource().get("messageId"));
			assertEquals("indexed payload should match", "some-payload", response.getSource().get("payload"));
		});
	List<Message> messages = indexDAO.getMessages("some-queue");
	assertEquals(1, messages.size());
	assertEquals(message.getId(), messages.get(0).getId());
	assertEquals(message.getPayload(), messages.get(0).getPayload());
}