@Test
public void testParseEocd() throws IOException {

  int eocdOffset = MinimalZipParser.locateStartOfEocd(unitTestZipArchive);
  ByteArrayInputStream in = new ByteArrayInputStream(unitTestZipArchive);
  Assert.assertEquals(eocdOffset, in.skip(eocdOffset));
  MinimalCentralDirectoryMetadata centralDirectoryMetadata = MinimalZipParser.parseEocd(in);
  Assert.assertNotNull(centralDirectoryMetadata);
  // Check that the central directory's first record is at the calculated offset
  //0x02014b50
  checkExpectedBytes(
      new byte[] {0x50, 0x4b, 0x01, 0x02},
      (int) centralDirectoryMetadata.getOffsetOfCentralDirectory());
  // Check that the central directory's length is correct, i.e. that the EOCD record follows it.
  long calculatedEndOfCentralDirectory =
      centralDirectoryMetadata.getOffsetOfCentralDirectory()
          + centralDirectoryMetadata.getLengthOfCentralDirectory();
  checkExpectedBytes(new byte[] {0x50, 0x4b, 0x05, 0x06}, (int) calculatedEndOfCentralDirectory);
  Assert.assertEquals(
      UnitTestZipArchive.allEntriesInFileOrder.size(),
      centralDirectoryMetadata.getNumEntriesInCentralDirectory());
}