@Test
  public void testFilterListWithORWhenPassingCellMismatchPreviousRC() throws IOException {
    // Mainly test FilterListWithOR#calculateReturnCodeByPrevCellAndRC method with two sub-filters.
    KeyValue kv1 = new KeyValue(Bytes.toBytes("row1"), Bytes.toBytes("fam"), Bytes.toBytes("a"),
      100, Bytes.toBytes("value"));
    KeyValue kv2 = new KeyValue(Bytes.toBytes("row1"), Bytes.toBytes("fam"), Bytes.toBytes("a"), 99,
      Bytes.toBytes("value"));
    KeyValue kv3 = new KeyValue(Bytes.toBytes("row1"), Bytes.toBytes("fam"), Bytes.toBytes("b"), 1,
      Bytes.toBytes("value"));
    KeyValue kv4 = new KeyValue(Bytes.toBytes("row1"), Bytes.toBytes("fan"), Bytes.toBytes("a"), 1,
      Bytes.toBytes("value"));
    Filter subFilter1 = Mockito.mock(FilterBase.class);
    Mockito.when(subFilter1.filterCell(kv1)).thenReturn(ReturnCode.INCLUDE_AND_NEXT_COL);
    Mockito.when(subFilter1.filterCell(kv2)).thenReturn(ReturnCode.NEXT_COL);
    Mockito.when(subFilter1.filterCell(kv3)).thenReturn(ReturnCode.INCLUDE_AND_NEXT_COL);
    Mockito.when(subFilter1.filterCell(kv4)).thenReturn(ReturnCode.INCLUDE_AND_NEXT_COL);

    Filter subFilter2 = Mockito.mock(FilterBase.class);
    Mockito.when(subFilter2.filterCell(kv1)).thenReturn(ReturnCode.SKIP);
    Mockito.when(subFilter2.filterCell(kv2)).thenReturn(ReturnCode.NEXT_ROW);
    Mockito.when(subFilter2.filterCell(kv3)).thenReturn(ReturnCode.NEXT_ROW);
    Mockito.when(subFilter2.filterCell(kv4)).thenReturn(ReturnCode.INCLUDE_AND_SEEK_NEXT_ROW);

    Filter filterList = new FilterList(Operator.MUST_PASS_ONE, subFilter1, subFilter2);
    Assert.assertEquals(ReturnCode.INCLUDE, filterList.filterCell(kv1));
    Assert.assertEquals(ReturnCode.NEXT_COL, filterList.filterCell(kv2));
    Assert.assertEquals(ReturnCode.INCLUDE_AND_NEXT_COL, filterList.filterCell(kv3));
    Assert.assertEquals(ReturnCode.INCLUDE_AND_NEXT_COL, filterList.filterCell(kv4));

    // One sub-filter will filterAllRemaining but other sub-filter will return SEEK_HINT
    subFilter1 = Mockito.mock(FilterBase.class);
    Mockito.when(subFilter1.filterAllRemaining()).thenReturn(true);
    Mockito.when(subFilter1.filterCell(kv1)).thenReturn(ReturnCode.NEXT_ROW);

    subFilter2 = Mockito.mock(FilterBase.class);
    Mockito.when(subFilter2.filterCell(kv1)).thenReturn(ReturnCode.SEEK_NEXT_USING_HINT);
    filterList = new FilterList(Operator.MUST_PASS_ONE, subFilter1, subFilter2);
    Assert.assertEquals(ReturnCode.SEEK_NEXT_USING_HINT, filterList.filterCell(kv1));

    // Two sub-filter returns SEEK_NEXT_USING_HINT, then we should return SEEK_NEXT_USING_HINT.
    subFilter1 = Mockito.mock(FilterBase.class);
    Mockito.when(subFilter1.filterCell(kv1)).thenReturn(ReturnCode.SEEK_NEXT_USING_HINT);

    subFilter2 = Mockito.mock(FilterBase.class);
    Mockito.when(subFilter2.filterCell(kv1)).thenReturn(ReturnCode.SEEK_NEXT_USING_HINT);
    filterList = new FilterList(Operator.MUST_PASS_ONE, subFilter1, subFilter2);
    Assert.assertEquals(ReturnCode.SEEK_NEXT_USING_HINT, filterList.filterCell(kv1));
  }
Tests the behavior of transform() in a hierarchical filter. transform() only applies after a
filterCell() whose return-code includes the KeyValue. Lazy evaluation of AND
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilterList.java