test_class.declarator: ENTRY_LEVEL_6 =
        UnitTestZipArchive.makeUnitTestZipEntry("/for/great/justice", 6, "entry A", null)
test_class.modifier: private static final
test_class.original_string: private static final UnitTestZipEntry ENTRY_LEVEL_6 =
        UnitTestZipArchive.makeUnitTestZipEntry("/for/great/justice", 6, "entry A", null);
test_class.type: UnitTestZipEntry
test_class.var_name: ENTRY_LEVEL_6
test_class.declarator: ENTRY_LEVEL_9 =
        UnitTestZipArchive.makeUnitTestZipEntry("/for/great/justice", 9, "entry A", null)
test_class.modifier: private static final
test_class.original_string: private static final UnitTestZipEntry ENTRY_LEVEL_9 =
        UnitTestZipArchive.makeUnitTestZipEntry("/for/great/justice", 9, "entry A", null);
test_class.type: UnitTestZipEntry
test_class.var_name: ENTRY_LEVEL_9
test_class.declarator: tempFilesCreated
test_class.modifier: private
test_class.original_string: private List<File> tempFilesCreated;
test_class.type: List<File>
test_class.var_name: tempFilesCreated
test_class.declarator: deltaFriendlyOldFile
test_class.modifier: private
test_class.original_string: private File deltaFriendlyOldFile;
test_class.type: File
test_class.var_name: deltaFriendlyOldFile
test_class.declarator: deltaFriendlyNewFile
test_class.modifier: private
test_class.original_string: private File deltaFriendlyNewFile;
test_class.type: File
test_class.var_name: deltaFriendlyNewFile
test_class.file: feya/libraries/archive_diff/diff.generator/src/test/java/com/google/archivepatcher/generator/PreDiffExecutorTest.java
test_class.identifier: PreDiffExecutorTest
test_case.body: @Test
    public void testPrepareForDiffing_OneCompressedEntry_Changed() throws IOException {
      byte[] oldBytes = UnitTestZipArchive.makeTestZip(Collections.singletonList(ENTRY_LEVEL_6));
      File oldFile = store(oldBytes);
      byte[] newBytes = UnitTestZipArchive.makeTestZip(Collections.singletonList(ENTRY_LEVEL_9));
      File newFile = store(newBytes);
      PreDiffExecutor executor =
          new PreDiffExecutor.Builder()
              .readingOriginalFiles(oldFile, newFile)
              .writingDeltaFriendlyFiles(deltaFriendlyOldFile, deltaFriendlyNewFile)
              .build();
      PreDiffPlan plan = executor.prepareForDiffing();
      Assert.assertNotNull(plan);
      // The plan should be to uncompress the data in both the old and new files.
      Assert.assertEquals(1, plan.getOldFileUncompressionPlan().size());
      Assert.assertEquals(1, plan.getNewFileUncompressionPlan().size());
      Assert.assertEquals(1, plan.getDeltaFriendlyNewFileRecompressionPlan().size());
      // The delta-friendly files should be larger than the originals.
      Assert.assertTrue(oldFile.length() < deltaFriendlyOldFile.length());
      Assert.assertTrue(newFile.length() < deltaFriendlyNewFile.length());
  
      // Nitty-gritty, assert that the file content is exactly what is expected.
      // 1. Find the entry in the old file.
      // 2. Create a buffer to hold the expected data.
      // 3. Copy all the file data that PRECEDES the compressed data into the buffer.
      // 4. Copy the UNCOMPRESSED data from the unit test object into the buffer.
      // 5. Copy all the file data the FOLLOWS the compressed data into the buffer.
      // This should be exactly what is produced. Note that this is not a valid ZIP archive, as the
      // offsets and lengths in the zip metadata are no longer tied to the actual data. This is
      // normal and expected, since the delta-friendly file is not actually an archive anymore.
      { // Scoping block for sanity
        MinimalZipEntry oldEntry = findEntry(oldFile, ENTRY_LEVEL_6.path);
        ByteArrayOutputStream expectedDeltaFriendlyOldFileBytes = new ByteArrayOutputStream();
        expectedDeltaFriendlyOldFileBytes.write(
            oldBytes, 0, (int) oldEntry.getFileOffsetOfCompressedData());
        expectedDeltaFriendlyOldFileBytes.write(ENTRY_LEVEL_6.getUncompressedBinaryContent());
        int oldRemainderOffset =
            (int) (oldEntry.getFileOffsetOfCompressedData() + oldEntry.getCompressedSize());
        int oldRemainderLength = oldBytes.length - oldRemainderOffset;
        expectedDeltaFriendlyOldFileBytes.write(oldBytes, oldRemainderOffset, oldRemainderLength);
        byte[] expectedOld = expectedDeltaFriendlyOldFileBytes.toByteArray();
        byte[] actualOld = readFile(deltaFriendlyOldFile);
        Assert.assertArrayEquals(expectedOld, actualOld);
      }
  
      // Now do the same for the new file and new entry
      { // Scoping block for sanity
        MinimalZipEntry newEntry = findEntry(newFile, ENTRY_LEVEL_9.path);
        ByteArrayOutputStream expectedDeltaFriendlyNewFileBytes = new ByteArrayOutputStream();
        expectedDeltaFriendlyNewFileBytes.write(
            newBytes, 0, (int) newEntry.getFileOffsetOfCompressedData());
        expectedDeltaFriendlyNewFileBytes.write(ENTRY_LEVEL_9.getUncompressedBinaryContent());
        int newRemainderOffset =
            (int) (newEntry.getFileOffsetOfCompressedData() + newEntry.getCompressedSize());
        int newRemainderLength = newBytes.length - newRemainderOffset;
        expectedDeltaFriendlyNewFileBytes.write(newBytes, newRemainderOffset, newRemainderLength);
        byte[] expectedNew = expectedDeltaFriendlyNewFileBytes.toByteArray();
        byte[] actualNew = readFile(deltaFriendlyNewFile);
        Assert.assertArrayEquals(expectedNew, actualNew);
      }
    }
test_case.class_method_signature: PreDiffExecutorTest.testPrepareForDiffing_OneCompressedEntry_Changed()
test_case.full_signature: @Test public void testPrepareForDiffing_OneCompressedEntry_Changed()
test_case.identifier: testPrepareForDiffing_OneCompressedEntry_Changed
test_case.invocations: makeTestZip singletonList store makeTestZip singletonList store build writingDeltaFriendlyFiles readingOriginalFiles prepareForDiffing assertNotNull assertEquals size getOldFileUncompressionPlan assertEquals size getNewFileUncompressionPlan assertEquals size getDeltaFriendlyNewFileRecompressionPlan assertTrue length length assertTrue length length findEntry write getFileOffsetOfCompressedData write getUncompressedBinaryContent getFileOffsetOfCompressedData getCompressedSize write toByteArray readFile assertArrayEquals findEntry write getFileOffsetOfCompressedData write getUncompressedBinaryContent getFileOffsetOfCompressedData getCompressedSize write toByteArray readFile assertArrayEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPrepareForDiffing_OneCompressedEntry_Changed()
focal_class.declarator: originalOldFile
focal_class.modifier: private final
focal_class.original_string: private final File originalOldFile;
focal_class.type: File
focal_class.var_name: originalOldFile
focal_class.declarator: originalNewFile
focal_class.modifier: private final
focal_class.original_string: private final File originalNewFile;
focal_class.type: File
focal_class.var_name: originalNewFile
focal_class.declarator: deltaFriendlyOldFile
focal_class.modifier: private final
focal_class.original_string: private final File deltaFriendlyOldFile;
focal_class.type: File
focal_class.var_name: deltaFriendlyOldFile
focal_class.declarator: deltaFriendlyNewFile
focal_class.modifier: private final
focal_class.original_string: private final File deltaFriendlyNewFile;
focal_class.type: File
focal_class.var_name: deltaFriendlyNewFile
focal_class.declarator: recommendationModifiers
focal_class.modifier: private final
focal_class.original_string: private final List<RecommendationModifier> recommendationModifiers;
focal_class.type: List<RecommendationModifier>
focal_class.var_name: recommendationModifiers
focal_class.file: feya/libraries/archive_diff/diff.generator/src/main/java/com/google/archivepatcher/generator/PreDiffExecutor.java
focal_class.identifier: PreDiffExecutor
focal_class.class_method_signature: PreDiffExecutor.PreDiffExecutor(
        File originalOldFile,
        File originalNewFile,
        File deltaFriendlyOldFile,
        File deltaFriendlyNewFile,
        List<RecommendationModifier> recommendationModifiers)
focal_class.full_signature: private  PreDiffExecutor(
        File originalOldFile,
        File originalNewFile,
        File deltaFriendlyOldFile,
        File deltaFriendlyNewFile,
        List<RecommendationModifier> recommendationModifiers)
focal_class.identifier: PreDiffExecutor
focal_class.modifiers: private
focal_class.parameters: (
        File originalOldFile,
        File originalNewFile,
        File deltaFriendlyOldFile,
        File deltaFriendlyNewFile,
        List<RecommendationModifier> recommendationModifiers)
focal_class.signature:  PreDiffExecutor(
        File originalOldFile,
        File originalNewFile,
        File deltaFriendlyOldFile,
        File deltaFriendlyNewFile,
        List<RecommendationModifier> recommendationModifiers)
focal_class.class_method_signature: PreDiffExecutor.prepareForDiffing()
focal_class.full_signature: public PreDiffPlan prepareForDiffing()
focal_class.identifier: prepareForDiffing
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: PreDiffPlan
focal_class.signature: PreDiffPlan prepareForDiffing()
focal_class.class_method_signature: PreDiffExecutor.generateDeltaFriendlyFiles(PreDiffPlan preDiffPlan)
focal_class.full_signature: private List<TypedRange<JreDeflateParameters>> generateDeltaFriendlyFiles(PreDiffPlan preDiffPlan)
focal_class.identifier: generateDeltaFriendlyFiles
focal_class.modifiers: private
focal_class.parameters: (PreDiffPlan preDiffPlan)
focal_class.return: List<TypedRange<JreDeflateParameters>>
focal_class.signature: List<TypedRange<JreDeflateParameters>> generateDeltaFriendlyFiles(PreDiffPlan preDiffPlan)
focal_class.class_method_signature: PreDiffExecutor.generatePreDiffPlan()
focal_class.full_signature: private PreDiffPlan generatePreDiffPlan()
focal_class.identifier: generatePreDiffPlan
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: PreDiffPlan
focal_class.signature: PreDiffPlan generatePreDiffPlan()
focal_method.body: public PreDiffPlan prepareForDiffing() throws IOException {
      PreDiffPlan preDiffPlan = generatePreDiffPlan();
      List<TypedRange<JreDeflateParameters>> deltaFriendlyNewFileRecompressionPlan = null;
      if (deltaFriendlyOldFile != null) {
        // Builder.writingDeltaFriendlyFiles() ensures old and new are non-null when called, so a
        // check on either is sufficient.
        deltaFriendlyNewFileRecompressionPlan =
            Collections.unmodifiableList(generateDeltaFriendlyFiles(preDiffPlan));
      }
      return new PreDiffPlan(
          preDiffPlan.getQualifiedRecommendations(),
          preDiffPlan.getOldFileUncompressionPlan(),
          preDiffPlan.getNewFileUncompressionPlan(),
          deltaFriendlyNewFileRecompressionPlan);
    }
focal_method.class_method_signature: PreDiffExecutor.prepareForDiffing()
focal_method.full_signature: public PreDiffPlan prepareForDiffing()
focal_method.identifier: prepareForDiffing
focal_method.invocations: generatePreDiffPlan unmodifiableList generateDeltaFriendlyFiles getQualifiedRecommendations getOldFileUncompressionPlan getNewFileUncompressionPlan
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: PreDiffPlan
focal_method.signature: PreDiffPlan prepareForDiffing()