private void writeRecords(Writer writer, boolean useTags) throws IOException {
    writeSomeRecords(writer, 0, 100, useTags);
    writer.close();
  }
Create a truncated hfile and verify that exception thrown.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java