@Test
public void testValidateEmptyEditLog() throws IOException {

  File testDir = new File(TEST_DIR, "testValidateEmptyEditLog");
  SortedMap<Long, Long> offsetToTxId = Maps.newTreeMap();
  File logFile = prepareUnfinalizedTestEditLog(testDir, 0, offsetToTxId);
  // Truncate the file so that there is nothing except the header and
  // layout flags section.
  truncateFile(logFile, 8);
  EditLogValidation validation =
      EditLogFileInputStream.scanEditLog(logFile, Long.MAX_VALUE, true);
  assertTrue(!validation.hasCorruptHeader());
  assertEquals(HdfsServerConstants.INVALID_TXID, validation.getEndTxId());
}