test_class.declarator: diviner = null
test_class.modifier: private
test_class.original_string: private DefaultDeflateCompressionDiviner diviner = null;
test_class.type: DefaultDeflateCompressionDiviner
test_class.var_name: diviner
test_class.declarator: testData = null
test_class.modifier: private
test_class.original_string: private byte[] testData = null;
test_class.type: byte[]
test_class.var_name: testData
test_class.file: feya/libraries/archive_diff/diff.generator/src/test/java/com/google/archivepatcher/generator/DefaultDeflateCompressionDivinerTest.java
test_class.identifier: DefaultDeflateCompressionDivinerTest
test_case.body: @Test
    public void testDivineDeflateParameters_AllValidSettings() throws IOException {
      for (boolean nowrap : new boolean[] {true, false}) {
        for (int strategy : new int[] {0, 1, 2}) {
          for (int level : new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9}) {
            JreDeflateParameters trueParameters = JreDeflateParameters.of(level, strategy, nowrap);
            final byte[] buffer = deflate(trueParameters);
            ByteArrayInputStreamFactory factory =
                new ByteArrayInputStreamFactory(buffer, true, false);
            JreDeflateParameters divinedParameters = diviner.divineDeflateParameters(factory);
            Assert.assertNotNull(divinedParameters);
            // TODO(andrewhayden) make *CERTAIN 100%( that strategy doesn't matter for level < 4.
            if (strategy == 1 && level <= 3) {
              // Strategy 1 produces identical output at levels 1, 2 and 3.
              Assert.assertEquals(JreDeflateParameters.of(level, 0, nowrap), divinedParameters);
            } else if (strategy == 2) {
              // All levels are the same with strategy 2.
              // TODO: Assert only one test gets done for this, should be the first level always.
              Assert.assertEquals(nowrap, divinedParameters.nowrap);
              Assert.assertEquals(strategy, divinedParameters.strategy);
            } else {
              Assert.assertEquals(trueParameters, divinedParameters);
            }
          } // End of iteration on level
        } // End of iteration on strategy
      } // End of iteration on nowrap
    }
test_case.class_method_signature: DefaultDeflateCompressionDivinerTest.testDivineDeflateParameters_AllValidSettings()
test_case.full_signature: @Test public void testDivineDeflateParameters_AllValidSettings()
test_case.identifier: testDivineDeflateParameters_AllValidSettings
test_case.invocations: of deflate divineDeflateParameters assertNotNull assertEquals of assertEquals assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDivineDeflateParameters_AllValidSettings()
focal_class.declarator: levelsByStrategy = getLevelsByStrategy()
focal_class.modifier: private final
focal_class.original_string: private final Map<Integer, List<Integer>> levelsByStrategy = getLevelsByStrategy();
focal_class.type: Map<Integer, List<Integer>>
focal_class.var_name: levelsByStrategy
focal_class.file: feya/libraries/archive_diff/diff.generator/src/main/java/com/google/archivepatcher/generator/DefaultDeflateCompressionDiviner.java
focal_class.identifier: DefaultDeflateCompressionDiviner
focal_class.class_method_signature: DefaultDeflateCompressionDiviner.divineDeflateParameters(File archiveFile)
focal_class.full_signature: public List<DivinationResult> divineDeflateParameters(File archiveFile)
focal_class.identifier: divineDeflateParameters
focal_class.modifiers: public
focal_class.parameters: (File archiveFile)
focal_class.return: List<DivinationResult>
focal_class.signature: List<DivinationResult> divineDeflateParameters(File archiveFile)
focal_class.class_method_signature: DefaultDeflateCompressionDiviner.getLevelsByStrategy()
focal_class.full_signature: protected Map<Integer, List<Integer>> getLevelsByStrategy()
focal_class.identifier: getLevelsByStrategy
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: Map<Integer, List<Integer>>
focal_class.signature: Map<Integer, List<Integer>> getLevelsByStrategy()
focal_class.class_method_signature: DefaultDeflateCompressionDiviner.divineDeflateParameters(
        MultiViewInputStreamFactory<?> compressedDataInputStreamFactory)
focal_class.full_signature: public JreDeflateParameters divineDeflateParameters(
        MultiViewInputStreamFactory<?> compressedDataInputStreamFactory)
focal_class.identifier: divineDeflateParameters
focal_class.modifiers: public
focal_class.parameters: (
        MultiViewInputStreamFactory<?> compressedDataInputStreamFactory)
focal_class.return: JreDeflateParameters
focal_class.signature: JreDeflateParameters divineDeflateParameters(
        MultiViewInputStreamFactory<?> compressedDataInputStreamFactory)
focal_class.class_method_signature: DefaultDeflateCompressionDiviner.matches(
        InputStream compressedDataIn,
        Inflater inflater,
        Deflater deflater,
        InputStream matchingStreamInput,
        byte[] copyBuffer)
focal_class.full_signature: private boolean matches(
        InputStream compressedDataIn,
        Inflater inflater,
        Deflater deflater,
        InputStream matchingStreamInput,
        byte[] copyBuffer)
focal_class.identifier: matches
focal_class.modifiers: private
focal_class.parameters: (
        InputStream compressedDataIn,
        Inflater inflater,
        Deflater deflater,
        InputStream matchingStreamInput,
        byte[] copyBuffer)
focal_class.return: boolean
focal_class.signature: boolean matches(
        InputStream compressedDataIn,
        Inflater inflater,
        Deflater deflater,
        InputStream matchingStreamInput,
        byte[] copyBuffer)
focal_method.body: public List<DivinationResult> divineDeflateParameters(File archiveFile) throws IOException {
      List<DivinationResult> results = new ArrayList<DivinationResult>();
      for (MinimalZipEntry minimalZipEntry : MinimalZipArchive.listEntries(archiveFile)) {
        JreDeflateParameters divinedParameters = null;
        if (minimalZipEntry.isDeflateCompressed()) {
          // TODO(andrewhayden): Reuse streams to avoid churning file descriptors
          RandomAccessFileInputStreamFactory rafisFactory =
              new RandomAccessFileInputStreamFactory(
                  archiveFile,
                  minimalZipEntry.getFileOffsetOfCompressedData(),
                  minimalZipEntry.getCompressedSize());
          divinedParameters = divineDeflateParameters(rafisFactory);
        }
        results.add(new DivinationResult(minimalZipEntry, divinedParameters));
      }
      return results;
    }
focal_method.class_method_signature: DefaultDeflateCompressionDiviner.divineDeflateParameters(File archiveFile)
focal_method.full_signature: public List<DivinationResult> divineDeflateParameters(File archiveFile)
focal_method.identifier: divineDeflateParameters
focal_method.invocations: listEntries isDeflateCompressed getFileOffsetOfCompressedData getCompressedSize divineDeflateParameters add
focal_method.modifiers: public
focal_method.parameters: (File archiveFile)
focal_method.return: List<DivinationResult>
focal_method.signature: List<DivinationResult> divineDeflateParameters(File archiveFile)