private void assertFilesEqual(File file1, File file2) throws IOException {
    try (InputStream is1 = Files.newInputStream(file1.toPath());
        InputStream is2 = Files.newInputStream(file2.toPath())) {
      byte[] buffer1 = new byte[1024];
      byte[] buffer2 = new byte[1024];
      int numRead1;
      int numRead2;
      while ((numRead1 = is1.read(buffer1)) != -1) {
        numRead2 = is2.read(buffer2);
        Assert.assertEquals(numRead1, numRead2);
        assertArrayEquals(buffer1, buffer2);
      }
      Assert.assertEquals(-1, is2.read(buffer2));
    }
  }
Asserts that the contents of two files are equal.
@param file1 the first file.
@param file2 the second file.
@throws IOException if an I/O error occurs.
ambry-file-transfer/src/test/java/com/github/ambry/filetransfer/handler/StoreFileCopyHandlerIntegTest.java