@Test
public void testParseLocalEntryAndGetCompressedDataOffset() throws Exception {

  ByteArrayInputStream in = new ByteArrayInputStream(unitTestZipArchive);
  in.mark(unitTestZipArchive.length);
  int eocdOffset = MinimalZipParser.locateStartOfEocd(unitTestZipArchive);
  Assert.assertEquals(eocdOffset, in.skip(eocdOffset));
  MinimalCentralDirectoryMetadata metadata = MinimalZipParser.parseEocd(in);
  in.reset();
  Assert.assertEquals(
      metadata.getOffsetOfCentralDirectory(), in.skip(metadata.getOffsetOfCentralDirectory()));
  // Read each entry and verify all fields *except* the value returned by
  // MinimalZipEntry.getFileOffsetOfCompressedData(), as that has yet to be computed.
  List<MinimalZipEntry> parsedEntries = new ArrayList<MinimalZipEntry>();
  for (int x = 0; x < UnitTestZipArchive.allEntriesInFileOrder.size(); x++) {
    parsedEntries.add(MinimalZipParser.parseCentralDirectoryEntry(in));
  }
  for (int x = 0; x < UnitTestZipArchive.allEntriesInFileOrder.size(); x++) {
    UnitTestZipEntry expectedEntry = UnitTestZipArchive.allEntriesInFileOrder.get(x);
    MinimalZipEntry parsedEntry = parsedEntries.get(x);
    in.reset();
    Assert.assertEquals(
        parsedEntry.getFileOffsetOfLocalEntry(),
        in.skip(parsedEntry.getFileOffsetOfLocalEntry()));
    long relativeDataOffset = MinimalZipParser.parseLocalEntryAndGetCompressedDataOffset(in);
    Assert.assertTrue(relativeDataOffset > 0);
    checkExpectedBytes(
        expectedEntry.getCompressedBinaryContent(),
        (int) (parsedEntry.getFileOffsetOfLocalEntry() + relativeDataOffset));
  }
}