@Test
public void testAddLockAndWriteColumnToGet() throws IOException {

  byte[][] families = new byte[][] {FAMILY, FAMILY, ANOTHER_FAMILY};
  byte[][] qualifiers = new byte[][] {QUALIFIER, ANOTHER_QUALIFIER, QUALIFIER};
  Get userGet = new Get(ROW);
  for (int i = 0; i < families.length; ++i) {
    userGet.addColumn(families[i], qualifiers[i]);
  }
  Get internalGet = new Get(userGet.getRow());
  ThemisCpUtil.addLockAndWriteColumnToGet(userGet, internalGet, PREWRITE_TS);
  Assert.assertEquals(3, internalGet.getFamilyMap().size());
  if (ColumnUtil.isCommitToSameFamily()) {
    Assert.assertEquals(4, internalGet.getFamilyMap().get(FAMILY).size());
    Assert.assertEquals(2, internalGet.getFamilyMap().get(ANOTHER_FAMILY).size());
  } else {
    Assert.assertEquals(3, internalGet.getFamilyMap().get(ColumnUtil.PUT_FAMILY_NAME_BYTES).size());
    Assert.assertEquals(3, internalGet.getFamilyMap().get(ColumnUtil.DELETE_FAMILY_NAME_BYTES).size());
  }
  Assert.assertEquals(3,
    internalGet.getFamilyMap().get(ColumnUtil.LOCK_FAMILY_NAME).size());
  for (int i = 0; i < families.length; ++i) {
    checkReadWithLockAndWriteColumns(internalGet.getFamilyMap(),
      new ColumnCoordinate(families[i], qualifiers[i]));
  }
  Assert.assertEquals(PREWRITE_TS, internalGet.getTimeRange().getMax());
  Assert.assertEquals(1, internalGet.getMaxVersions());
  
  // test for family-level transfer
  userGet = new Get(ROW);
  userGet.addFamily(FAMILY);
  internalGet = new Get(userGet.getRow());
  ThemisCpUtil.addLockAndWriteColumnToGet(userGet, internalGet, PREWRITE_TS);
  if (ColumnUtil.isCommitToSameFamily()) {
    checkAddLockAndDataFamily(internalGet, ColumnUtil.LOCK_FAMILY_NAME, FAMILY);
  } else {
    checkAddLockAndDataFamily(internalGet, ColumnUtil.LOCK_FAMILY_NAME,
      ColumnUtil.PUT_FAMILY_NAME_BYTES, ColumnUtil.DELETE_FAMILY_NAME_BYTES);
  }
  Assert.assertTrue(internalGet.getFilter() instanceof ExcludeDataColumnFilter);
  
  // test for combination of family-level and column-level transfer
  userGet = new Get(ROW);
  userGet.addFamily(ANOTHER_FAMILY); // another family will be processed firstly
  userGet.addColumn(FAMILY, ANOTHER_QUALIFIER); // the column should not overwrite lock family
  internalGet = new Get(userGet.getRow());
  ThemisCpUtil.addLockAndWriteColumnToGet(userGet, internalGet, PREWRITE_TS);
  if (ColumnUtil.isCommitToSameFamily()) {
    checkAddLockAndDataFamily(internalGet, ColumnUtil.LOCK_FAMILY_NAME, ANOTHER_FAMILY);
    checkReadWithWriteColumns(internalGet.getFamilyMap(), new ColumnCoordinate(FAMILY,
        ANOTHER_QUALIFIER));
  } else {
    checkAddLockAndDataFamily(internalGet, ColumnUtil.LOCK_FAMILY_NAME,
      ColumnUtil.PUT_FAMILY_NAME_BYTES, ColumnUtil.DELETE_FAMILY_NAME_BYTES);
  }
  Assert.assertTrue(internalGet.getFilter() instanceof ExcludeDataColumnFilter);
}