@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);
        JreDeflateParameters divinedParameters =
            diviner.divineDeflateParameters(new ByteArrayInputStreamFactory(buffer));
        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(
              /*expected=*/ JreDeflateParameters.of(level, 0, nowrap),
              /*actual=*/ 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
}