@Override
    public void flush(Queue<Record> records) {
      LOG.info("DummyQueryHistoryRepository to flush {} records", records.size());
      // saving for unit test purposes
      this.record = records.poll();
      records.clear();
    }
This unit test asserts that the record is created as expected from the various hive source objects like:
DriverContext, SessionState, QueryInfo, etc.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/queryhistory/TestQueryHistoryService.java