@Test
public void testDivineDeflateParameters_File() throws IOException {

  File tempFile = File.createTempFile("ddcdt", "tmp");
  tempFile.deleteOnExit();
  try {
    UnitTestZipArchive.saveTestZip(tempFile);
    List<DivinationResult> results = diviner.divineDeflateParameters(tempFile);
    Assert.assertEquals(UnitTestZipArchive.allEntriesInFileOrder.size(), results.size());
    for (int x = 0; x < results.size(); x++) {
      UnitTestZipEntry expected = UnitTestZipArchive.allEntriesInFileOrder.get(x);
      DivinationResult actual = results.get(x);
      Assert.assertEquals(expected.path, actual.minimalZipEntry.getFileName());
      int expectedLevel = expected.level;
      if (expectedLevel > 0) {
        // Compressed entry
        Assert.assertTrue(actual.minimalZipEntry.isDeflateCompressed());
        Assert.assertNotNull(actual.divinedParameters);
        Assert.assertEquals(expectedLevel, actual.divinedParameters.level);
        Assert.assertEquals(0, actual.divinedParameters.strategy);
        Assert.assertTrue(actual.divinedParameters.nowrap);
      } else {
        // Uncompressed entry
        Assert.assertFalse(actual.minimalZipEntry.isDeflateCompressed());
        Assert.assertNull(actual.divinedParameters);
      }
    }
  } finally {
    try {
      tempFile.delete();
    } catch (Exception ignoreD) {
      // Nothing
    }
  }
}