@Test
public void testMoveRowkeyFiltersForWriteColumnGet() throws IOException {

  Get sourceGet = new Get(ROW);
  Get dstGet = new Get(ROW);
  ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet);
  Assert.assertNull(sourceGet.getFilter());
  Assert.assertNull(dstGet.getFilter());
  dstGet.setFilter(null);
  // can not move filter, no rowkey filter
  Filter expected = new SingleColumnValueFilter();
  sourceGet.setFilter(expected);
  ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet);
  Assert.assertEquals(expected, sourceGet.getFilter());
  Assert.assertNull(dstGet.getFilter());
  dstGet.setFilter(null);
  // can not move filter, has operation=MUST_PASS_ONE
  FilterList filters = new FilterList(Operator.MUST_PASS_ONE);
  filters.addFilter(new SingleColumnValueFilter());
  filters.addFilter(new PrefixFilter());
  sourceGet.setFilter(filters);
  ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet);
  Assert.assertEquals(filters, sourceGet.getFilter());
  Assert.assertNull(dstGet.getFilter());
  dstGet.setFilter(null);
  // move filter, concrete rowkey filter
  expected = new PrefixFilter();
  sourceGet.setFilter(expected);
  ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet);
  Assert.assertEquals(0, ((FilterList)sourceGet.getFilter()).getFilters().size());
  Assert.assertEquals(1, ((FilterList)dstGet.getFilter()).getFilters().size());
  Assert.assertEquals(expected, ((FilterList)dstGet.getFilter()).getFilters().get(0));
  dstGet.setFilter(null);
  // move filter, filterlist with MUST_PASS_ALL
  filters = new FilterList();
  filters.addFilter(new SingleColumnValueFilter());
  filters.addFilter(new PrefixFilter());
  sourceGet.setFilter(filters);
  ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet);
  FilterList sourceFilter = (FilterList)sourceGet.getFilter();
  FilterList dstFilter = (FilterList)dstGet.getFilter();
  Assert.assertEquals(1, sourceFilter.getFilters().size());
  Assert.assertTrue(sourceFilter.getFilters().get(0) instanceof SingleColumnValueFilter);
  Assert.assertEquals(1, dstFilter.getFilters().size());
  Assert.assertTrue(dstFilter.getFilters().get(0) instanceof PrefixFilter);
  dstGet.setFilter(null);
  // test customer filters
  filters = new FilterList();
  filters.addFilter(new SingleColumnValueFilter());
  filters.addFilter(new PrefixFilter());
  filters.addFilter(new CustomerRowkeyFilter(ROW));
  filters.addFilter(new CustomerColumnFilter(QUALIFIER));
  sourceGet.setFilter(filters);
  ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet);
  sourceFilter = (FilterList)sourceGet.getFilter();
  dstFilter = (FilterList)dstGet.getFilter();
  Assert.assertEquals(2, sourceFilter.getFilters().size());
  for (Filter filter : sourceFilter.getFilters()) {
    Assert.assertFalse(filter instanceof PrefixFilter);
    Assert.assertFalse(filter instanceof CustomerRowkeyFilter);
  }
  Assert.assertEquals(2, dstFilter.getFilters().size());
  for (Filter filter : dstFilter.getFilters()) {
    Assert.assertFalse(filter instanceof SingleColumnValueFilter);
    Assert.assertFalse(filter instanceof CustomerColumnFilter);
  }
  dstGet.setFilter(null);
  
  // test destGet with exist Filters
  filters = new FilterList();
  filters.addFilter(new SingleColumnValueFilter());
  filters.addFilter(new PrefixFilter());
  sourceGet.setFilter(filters);
  dstGet.setFilter(new ExcludeDataColumnFilter());
  ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet);
  sourceFilter = (FilterList)sourceGet.getFilter();
  dstFilter = (FilterList)dstGet.getFilter();
  Assert.assertEquals(2, dstFilter.getFilters().size());
  Assert.assertTrue((dstFilter.getFilters().get(0) instanceof ExcludeDataColumnFilter)
      || (dstFilter.getFilters().get(1) instanceof ExcludeDataColumnFilter));
  dstGet.setFilter(null);
}