public void testCreateAndRead_SingleHistoryEntry() {
UserIdentifier userId = new UserIdentifier(UUID.randomUUID());
QueryHistory newHistory = new QueryHistory();
CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable");
QueryEntry histEntry = new QueryEntry(query, 6645);
newHistory.add(histEntry);
storage.store(userId, newHistory);
Optional<QueryHistory> readHistory = storage.read(userId, QueryHistory.class);
assertNotNull(readHistory);
assertEquals(1, readHistory.get().size());
int idx = 0;
List<QueryEntry> histList = readHistory.get().copyAsList();
try (QueryHistory.HistoryIterator historyIterator = readHistory.get().iterator()) {
assertTrue(historyIterator.hasNext());
QueryEntry readEntry = historyIterator.next();
assertEquals(histList.get(idx++), readEntry);
assertEquals(query, readEntry.query);
assertEquals(histEntry.executedOnUtc.toString(), readEntry.executedOnUtc.toString());
assertEquals(0, storage.getLockRetryCount());