@Test
public void testApplyToScan() throws Exception {
// Initialize a scan object with some requested data.
final KijiDataRequest priorDataRequest = KijiDataRequest.create("family", "column");
final Scan actualScan =
new HBaseDataRequestAdapter(priorDataRequest, mColumnNameTranslator).toScan(mTableLayout);
// Construct a row filter and apply it to the existing scan.
final KijiRowFilter rowFilter = new MyKijiRowFilter();
final KijiRowFilterApplicator applicator =
KijiRowFilterApplicator.create(rowFilter, mTableLayout, getKiji().getSchemaTable());
applicator.applyTo(actualScan);
// After filter application, expect the scan to also have the column requested by the filter.
final Scan expectedScan =
new HBaseDataRequestAdapter(
priorDataRequest.merge(rowFilter.getDataRequest()), mColumnNameTranslator)
.toScan(mTableLayout);
expectedScan.setFilter(mHBaseFilter);
assertEquals(expectedScan.toString(), actualScan.toString());
assertTrue(new ScanEquals(expectedScan).matches(actualScan));