private void verifyScan(Scan s, long expectedRows, long expectedKeys) throws IOException {
    InternalScanner scanner = this.region.getScanner(s);
    List<Cell> results = new ArrayList<>();
    int i = 0;
    for (boolean done = true; done; i++) {
      done = scanner.next(results);
      Arrays.sort(results.toArray(new Cell[results.size()]), CellComparator.getInstance());
      LOG.info("counter=" + i + ", " + results);
      if (results.isEmpty()) break;
      assertTrue("Scanned too many rows! Only expected " + expectedRows
        + " total but already scanned " + (i + 1), expectedRows > i);
      assertEquals("Expected " + expectedKeys + " keys per row but " + "returned " + results.size(),
        expectedKeys, results.size());
      results.clear();
    }
    assertEquals("Expected " + expectedRows + " rows but scanned " + i + " rows", expectedRows, i);
  }
Tests the the {@link WhileMatchFilter} works in combination with a {@link Filter} that uses the
{@link Filter#filterCell(Cell)} method. See HBASE-2258.
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilter.java