*/
@Test
public void testHintCorrectlyToNextFamily() {
// start with doing a family delete, so we will seek to the next column
KeyValue kv = createKvForType(Type.DeleteFamily);
ApplyAndFilterDeletesFilter filter = new ApplyAndFilterDeletesFilter(EMPTY_SET);
assertEquals(ReturnCode.SKIP, filter.filterKeyValue(kv));
KeyValue next = createKvForType(Type.Put);
// make sure the hint is our attempt at the end key, because we have no more families to seek
assertEquals("Didn't get a hint from a family delete", ReturnCode.SEEK_NEXT_USING_HINT,
filter.filterKeyValue(next));
assertEquals("Didn't get END_KEY with no families to match", KeyValue.LOWESTKEY,
filter.getNextKeyHint(next));
// check for a family that comes before our family, so we always seek to the end as well
filter = new ApplyAndFilterDeletesFilter(asSet(Bytes.toBytes("afamily")));
assertEquals(ReturnCode.SKIP, filter.filterKeyValue(kv));
// make sure the hint is our attempt at the end key, because we have no more families to seek
assertEquals("Didn't get a hint from a family delete", ReturnCode.SEEK_NEXT_USING_HINT,
filter.filterKeyValue(next));
assertEquals("Didn't get END_KEY with no families to match", KeyValue.LOWESTKEY,
filter.getNextKeyHint(next));
// check that we seek to the correct family that comes after our family
byte[] laterFamily = Bytes.toBytes("zfamily");
filter = new ApplyAndFilterDeletesFilter(asSet(laterFamily));
assertEquals(ReturnCode.SKIP, filter.filterKeyValue(kv));
KeyValue expected = KeyValue.createFirstOnRow(kv.getRow(), laterFamily, new byte[0]);
assertEquals("Didn't get a hint from a family delete", ReturnCode.SEEK_NEXT_USING_HINT,
filter.filterKeyValue(next));
assertEquals("Didn't get correct next key with a next family", expected,
filter.getNextKeyHint(next));
}