@Test
public void testCreateScanWithLockAndWriteColumns() throws IOException {

  byte[] startRow = Bytes.toBytes("aaa");
  byte[] stopRow = Bytes.toBytes("bbb");
  Scan scan = new Scan(startRow, stopRow);
  scan.addColumn(FAMILY, QUALIFIER);
  scan.addColumn(ANOTHER_FAMILY, ANOTHER_QUALIFIER);
  Scan createdScan = ThemisCpUtil.constructLockAndWriteScan(scan, PREWRITE_TS);
  Assert.assertArrayEquals(startRow, createdScan.getStartRow());
  Assert.assertArrayEquals(stopRow, createdScan.getStopRow());
  Assert.assertEquals(3, createdScan.getFamilies().length);
  checkReadWithLockAndWriteColumns(createdScan.getFamilyMap(), COLUMN);
  checkReadWithLockAndWriteColumns(createdScan.getFamilyMap(),
    new ColumnCoordinate(ANOTHER_FAMILY, ANOTHER_QUALIFIER));
  
  // test scan family
  scan = new Scan(startRow, stopRow);
  scan.addFamily(ANOTHER_FAMILY);
  scan.addColumn(FAMILY, QUALIFIER);
  createdScan = ThemisCpUtil.constructLockAndWriteScan(scan, PREWRITE_TS);
  Assert.assertArrayEquals(startRow, createdScan.getStartRow());
  Assert.assertArrayEquals(stopRow, createdScan.getStopRow());
  if (ColumnUtil.isCommitToSameFamily()) {
    Assert.assertEquals(3, createdScan.getFamilies().length);
    checkReadWithWriteColumns(createdScan.getFamilyMap(), new ColumnCoordinate(FAMILY,
      QUALIFIER));
  } else {
    Assert.assertEquals(4, createdScan.getFamilies().length);
  }
  Assert.assertTrue(createdScan.getFamilyMap().containsKey(ANOTHER_FAMILY)
      && createdScan.getFamilyMap().get(ANOTHER_FAMILY) == null);
  Assert.assertTrue(createdScan.getFamilyMap().containsKey(ColumnUtil.LOCK_FAMILY_NAME)
    && createdScan.getFamilyMap().get(ColumnUtil.LOCK_FAMILY_NAME) == null);
  Assert.assertTrue(createdScan.getFilter() instanceof ExcludeDataColumnFilter);
}