@Test
public void testSkipFiltering() throws Exception {

  long timestamp = System.currentTimeMillis();
  // Test to check that we get NEXT_COL once the INCLUDE_AND_NEXT_COL is returned for the same key
  Filter filter = new CellSkipFilter(new MyFilter(0));
  assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY, VALUE,
                                                                            timestamp)));
  assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY,
                                                                                         VALUE, timestamp - 1)));
  // Next call should get NEXT_COL instead of SKIP, as it would be returned by CellSkipFilter
  assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY, VALUE,
                                                                             timestamp - 2)));
  // Next call with the same key should return the NEXT_COL again, as it would be returned by CellSkipFilter
  assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY, VALUE,
                                                                             timestamp - 3)));
  // Since MyFilter counter is not incremented in the previous call, filtering for the different keyvalue should
  // give SKIP from MyFilter
  assertEquals(Filter.ReturnCode.SKIP, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM2KEY, COL1KEY, VALUE,
                                                                         timestamp - 4)));
  // Test to check that we get NEXT_COL once the NEXT_COL is returned for the same key
  filter = new CellSkipFilter(new MyFilter(2));
  assertEquals(Filter.ReturnCode.SKIP, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY, VALUE,
                                                                         timestamp)));
  assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY, VALUE,
                                                                             timestamp - 1)));
  // Next call should get NEXT_COL instead of NEXT_ROW, as it would be returned by CellSkipFilter
  assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY, VALUE,
                                                                             timestamp - 2)));
  // Next call with the same key should return the NEXT_COL again, as it would be returned by CellSkipFilter
  assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL1KEY, VALUE,
                                                                             timestamp - 3)));
  // Since MyFilter counter is not incremented in the previous call, filtering for the different keyvalue should
  // give NEXT_ROW from MyFilter
  assertEquals(Filter.ReturnCode.NEXT_ROW, filter.filterKeyValue(newKeyValue(ROW1KEY, FAM1KEY, COL2KEY, VALUE,
                                                                             timestamp - 4)));
  // Next call with the new key should returned the SEEK_NEXT_USING_HINT
  assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterKeyValue(newKeyValue(ROW2KEY, FAM1KEY, COL1KEY,
                                                                                         VALUE, timestamp - 5)));
}