private void assertArrayEqualsBuffer(String msgPrefix, byte[] arr, ByteBuffer buf) {
    assertEquals(
      msgPrefix + ": expected " + Bytes.toStringBinary(arr) + ", actual "
        + Bytes.toStringBinary(buf),
      0, Bytes.compareTo(arr, 0, arr.length, buf.array(), buf.arrayOffset(), buf.limit()));
  }
Testing block index through the HFile writer/reader APIs. Allows to test setting index block
size through configuration, intermediate-level index blocks, and caching index blocks on write.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.java