@Test
public void testSortOrder() {

  // events should sort in the reverse order we put them on
  long now = System.currentTimeMillis();
  List<LogRecord> records = Lists.newArrayList();
  for (int i = 0; i < 3; i++) {
    Commit commit = new Commit((long)i, now - i);
    LogRecord logRecord = new LogRecord(1, i, commit);
    records.add(logRecord);
  }
  LogRecord logRecord;
  logRecord = Collections.min(records);
  Assert.assertTrue(String.valueOf(logRecord.getOffset()),
      2 == logRecord.getOffset());
  records.remove(logRecord);
  logRecord = Collections.min(records);
  Assert.assertTrue(String.valueOf(logRecord.getOffset()),
      1 == logRecord.getOffset());
  records.remove(logRecord);
  logRecord = Collections.min(records);
  Assert.assertTrue(String.valueOf(logRecord.getOffset()),
      0 == logRecord.getOffset());
  records.remove(logRecord);
}