SortedMapIterator source = new SortedMapIterator(createKeyValues());
RowFilter filter = new RowZeroOrOneFilter();
filter.init(source, Collections.<String,String> emptyMap(), new DefaultIteratorEnvironment());
filter.seek(new Range(), Collections.<ByteSequence> emptySet(), false);
// Save off the first key and value
Key firstKey = filter.getTopKey();
Value firstValue = filter.getTopValue();
// Assert that the row is valid given our filter
assertEquals("0", firstKey.getRow().toString());
// Read some extra data, just making sure it's all valid
Key lastKeyRead = null;
for (int i = 0; i < 5; i++) {
filter.next();
lastKeyRead = filter.getTopKey();
assertEquals("0", lastKeyRead.getRow().toString());
}
// Make a copy of the original RowFilter
RowFilter copy = (RowFilter) filter.deepCopy(new DefaultIteratorEnvironment());
// Because it's a copy, we should be able to safely seek this one without affecting the original
copy.seek(new Range(), Collections.<ByteSequence> emptySet(), false);
assertTrue("deepCopy'ed RowFilter did not have a top key", copy.hasTop());
Key firstKeyFromCopy = copy.getTopKey();
Value firstValueFromCopy = copy.getTopValue();