@Test
 public void topLevelPageFilterIsSupported() {
   FilterAdapterContext context = new FilterAdapterContext(new Scan(), new DefaultReadHooks());
   PageFilter filter = new PageFilter(20);
   FilterSupportStatus status = pageFilterAdapter.isFilterSupported(context, filter);
   Assert.assertTrue("Top-level page filter should be supported", status.isSupported());
 }
 @Test
 public void mustPassAllIsSupportedAtTopLevel() {
   FilterAdapterContext context = new FilterAdapterContext(new Scan(), new DefaultReadHooks());
   PageFilter filter = new PageFilter(20);
   FilterList filterList = new FilterList(Operator.MUST_PASS_ALL, filter);
   try (ContextCloseable ignored = context.beginFilterList(filterList)) {
     FilterSupportStatus status = pageFilterAdapter.isFilterSupported(context, filter);
     Assert.assertTrue(
         "MUST_PASS_ALL should be supported at the top-level.", status.isSupported());
   }
 }
 @Test
 public void mustPassOneIsNotSupported() {
   FilterAdapterContext context = new FilterAdapterContext(new Scan(), new DefaultReadHooks());
   PageFilter filter = new PageFilter(20);
   FilterList filterList = new FilterList(Operator.MUST_PASS_ONE, filter);
   try (ContextCloseable ignroed = context.beginFilterList(filterList)) {
     FilterSupportStatus status = pageFilterAdapter.isFilterSupported(context, filter);
     Assert.assertFalse(
         "MUST_PASS_ONE FilterLists should not be supported.", status.isSupported());
   }
 }
  @Test
  public void pageFilterIsAppliedToReadRowsRequest() throws IOException {
    ReadHooks hooks = new DefaultReadHooks();
    FilterAdapterContext context = new FilterAdapterContext(new Scan(), hooks);
    PageFilter pageFilter = new PageFilter(20);
    RowFilter adaptedFilter = pageFilterAdapter.adapt(context, pageFilter);
    Assert.assertNull("PageFilterAdapter should not return a RowFilter.", adaptedFilter);

    ReadRowsRequest request = ReadRowsRequest.newBuilder().setNumRowsLimit(100).build();
    ReadRowsRequest postHookRequest = hooks.applyPreSendHook(request);
    Assert.assertEquals(20, postHookRequest.getNumRowsLimit());
  }
 @Test
 public void mustPassAllIsNotSupportedBelowTopLevel() {
   FilterAdapterContext context = new FilterAdapterContext(new Scan(), new DefaultReadHooks());
   PageFilter pageFilter = new PageFilter(20);
   FilterList secondLevelList = new FilterList(Operator.MUST_PASS_ALL, pageFilter);
   FilterList topLevelList = new FilterList(Operator.MUST_PASS_ALL, secondLevelList);
   try (ContextCloseable ignored = context.beginFilterList(topLevelList)) {
     try (ContextCloseable evenMoreIgnored = context.beginFilterList(secondLevelList)) {
       FilterSupportStatus status = pageFilterAdapter.isFilterSupported(context, pageFilter);
       Assert.assertFalse(
           "MUST_PASS_ALL should not be supported lower than top level.", status.isSupported());
     }
   }
 }
 @Test
 public void pageFilterMustBeInLastPosition() {
   FilterAdapterContext context = new FilterAdapterContext(new Scan(), new DefaultReadHooks());
   ValueFilter valueFilter =
       new ValueFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("value")));
   PageFilter pageFilter = new PageFilter(20);
   FilterList filterList = new FilterList(Operator.MUST_PASS_ALL, pageFilter, valueFilter);
   try (ContextCloseable ignored = context.beginFilterList(filterList)) {
     FilterSupportStatus status = pageFilterAdapter.isFilterSupported(context, pageFilter);
     Assert.assertFalse(
         "PageFilter must be in the last position of a MUST_PASS_ALL filter list",
         status.isSupported());
   }
 }