private void verifyScanResult(Table table, Scan scan, List<byte[]> expectedKeys, String message) {
    List<byte[]> actualKeys = new ArrayList<>();
    try {
      ResultScanner scanner = table.getScanner(scan);
      for (Result result : scanner) {
        actualKeys.add(result.getRow());
      }

      String fullMessage = message;
      if (LOG.isDebugEnabled()) {
        fullMessage = message + "\n"
          + tableOfTwoListsOfByteArrays("Expected", expectedKeys, "Actual  ", actualKeys);
      }

      Assert.assertArrayEquals(fullMessage, expectedKeys.toArray(), actualKeys.toArray());
    } catch (IOException e) {
      e.printStackTrace();
      Assert.fail();
    }
  }
Note that about half of these tests were relevant for a different implementation approach of
setStartStopRowForPrefixScan. These test cases have been retained to ensure that also the
edge cases found there are still covered.
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java