@Test
public void testExplainPatch_CompressedBytesChanged_UncompressedChanged_Limited()
    throws Exception {

  // Just like above, but this time with a TotalRecompressionLimit that changes the result.
  TotalRecompressionLimiter limiter = new TotalRecompressionLimiter(1); // 1 byte limit!
  byte[] oldBytes = UnitTestZipArchive.makeTestZip(Collections.singletonList(ENTRY_A1_LEVEL_6));
  byte[] newBytes = UnitTestZipArchive.makeTestZip(Collections.singletonList(ENTRY_A2_LEVEL_9));
  save(oldBytes, oldFile);
  save(newBytes, newFile);
  // Note that we will expect a diff based on the COMPRESSED bytes, not the UNCOMPRESSED bytes,
  // because the limiter will force uncompression to be suppressed.
  FakeDeltaGenerator fakeDeltaGenerator =
      new FakeDeltaGenerator(
          ENTRY_A1_LEVEL_6.getCompressedBinaryContent(),
          ENTRY_A2_LEVEL_9.getCompressedBinaryContent());
  FakeCompressor fakeCompressor =
      new FakeCompressor(FakeDeltaGenerator.OUTPUT.getBytes("US-ASCII"));
  PatchExplainer explainer = new PatchExplainer(fakeCompressor, fakeDeltaGenerator);
  List<EntryExplanation> explanations = explainer.explainPatch(oldFile, newFile, limiter);
  // The uncompressed bytes are not the same. The patch plan will want to uncompress the entries,
  // but the limiter will prevent it.
  EntryExplanation expected =
      new EntryExplanation(
          path(ENTRY_A2_LEVEL_9),
          false,
          RecommendationReason.RESOURCE_CONSTRAINED,
          FakeCompressor.OUTPUT.length());
  checkExplanation(explanations, expected);
}