@Test
  public void testFirstKeyOnlyFilterAndBatch() throws IOException {
    Scan scan = new Scan();
    scan.setFilter(new FirstKeyOnlyFilter());
    scan.setBatch(1);
    InternalScanner scanner = REGION.getScanner(scan);
    List<Cell> results = new ArrayList<>();
    for (int i = 0; i < NUM_ROWS; i++) {
      results.clear();
      scanner.next(results);
      assertEquals(1, results.size());
      Cell cell = results.get(0);
      assertArrayEquals(ROWS[i],
        Bytes.copy(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
    }
    assertFalse(scanner.next(results));
    scanner.close();
  }
To test behavior of filters at server from region side.
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilterFromRegionSide.java