public static void assertInputStreamEqual(InputStream expect, InputStream actual, int size,
      boolean checkActualComplete) throws IOException {
    byte[] actualBuf = Utils.readBytesFromStream(actual, size);
    if (checkActualComplete) {
      int finalRead = actual.read();
      // some InputStream impls in Ambry return 0 instead of -1 when they end
      assertTrue("Actual stream had more bytes than expected", finalRead == 0 || finalRead == -1);
    }
    byte[] expectBuf = Utils.readBytesFromStream(expect, size);
    assertArrayEquals("Data from actual stream does not match expected", expectBuf, actualBuf);
  }
Asserts that {@code actual} and {@code expect} are equal. Checks that {@code actual}
contains no extra data if {@code checkActualComplete} is {@code true}.
ambry-test-utils/src/main/java/com/github/ambry/utils/TestUtils.java