protected void testSeekToInternals(TagUsage tagUsage) throws IOException {
    Path p = makeNewFile(tagUsage);
    FileSystem fs = TEST_UTIL.getTestFileSystem();
    Configuration conf = TEST_UTIL.getConfiguration();
    HFile.Reader reader = HFile.createReader(fs, p, new CacheConfig(conf), true, conf);
    assertEquals(2, reader.getDataBlockIndexReader().getRootBlockCount());
    HFileScanner scanner = reader.getScanner(conf, false, true);
    // lies before the start of the file.
    assertEquals(-1, scanner.seekTo(toKV("a", tagUsage)));

    assertEquals(1, scanner.seekTo(toKV("d", tagUsage)));
    assertEquals("c", toRowStr(scanner.getCell()));

    // Across a block boundary now.
    // 'h' does not exist so we will get a '1' back for not found.
    assertEquals(0, scanner.seekTo(toKV("i", tagUsage)));
    assertEquals("i", toRowStr(scanner.getCell()));

    assertEquals(1, scanner.seekTo(toKV("l", tagUsage)));
    assertEquals("k", toRowStr(scanner.getCell()));

    reader.close();
    deleteTestDir(fs);
  }
Test {@link HFileScanner#seekTo(Cell)} and its variants.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java