@Test
  public void testInferBoundaries() {
    TreeMap<byte[], Integer> map = new TreeMap<>(Bytes.BYTES_COMPARATOR);

    /*
     * Toy example c---------i o------p s---------t v------x a------e g-----k m-------------q r----s
     * u----w Should be inferred as: a-----------------k m-------------q r--------------t
     * u---------x The output should be (m,r,u)
     */

    String first;
    String last;

    first = "a";
    last = "e";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "r";
    last = "s";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "o";
    last = "p";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "g";
    last = "k";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "v";
    last = "x";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "c";
    last = "i";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "m";
    last = "q";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "s";
    last = "t";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    first = "u";
    last = "w";
    addStartEndKeysForTest(map, Bytes.toBytes(first), Bytes.toBytes(last));

    byte[][] keysArray = BulkLoadHFilesTool.inferBoundaries(map);
    byte[][] compare = new byte[3][];
    compare[0] = Bytes.toBytes("m");
    compare[1] = Bytes.toBytes("r");
    compare[2] = Bytes.toBytes("u");

    assertEquals(3, keysArray.length);

    for (int row = 0; row < keysArray.length; row++) {
      assertArrayEquals(keysArray[row], compare[row]);
    }
  }
test split storefile with favorite node information
hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestBulkLoadHFiles.java