private void testFirstNBytes(
      byte[] byteArray, int n, boolean foundNewScan, int expectedBestScan, int bestScanEndOffset) {
    assertEquals(
        foundNewScan,
        mProgressiveJpegParser.parseMoreData(
            buildEncodedImage(new TrivialPooledByteBuffer(Arrays.copyOf(byteArray, n)))));
    assertTrue(mProgressiveJpegParser.isJpeg());
    assertEquals(expectedBestScan, mProgressiveJpegParser.getBestScanNumber());
    assertEquals(bestScanEndOffset, mProgressiveJpegParser.getBestScanEndOffset());
  }
Feeds mProgressiveJpegParser with n initial bytes from byteArray and checks that

@param byteArray
@param n
@param foundNewScan expected return value of ProgressiveJpegParser.parseMoreData
@param expectedBestScan expected number of scans found by the parser + 1
@param bestScanEndOffset offset of expected best scan found so far
imagepipeline/src/test/java/com/facebook/imagepipeline/decoder/ProgressiveJpegParserTest.java