Program: 29946
Project: 29946
Buggy source:
@Test public void testAddLockAndWriteColumnToGet() throws IOException {
  byte[][] families=new byte[][]{FAMILY,FAMILY,ANOTHER_FAMILY};
  byte[][] qualifiers=new byte[][]{QUALIFIER,ANOTHER_FAMILY,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());
  Assert.assertEquals(4,internalGet.getFamilyMap().get(FAMILY).size());
  Assert.assertEquals(2,internalGet.getFamilyMap().get(ANOTHER_FAMILY).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());
  userGet=new Get(ROW);
  userGet.addFamily(FAMILY);
  internalGet=new Get(userGet.getRow());
  ThemisCpUtil.addLockAndWriteColumnToGet(userGet,internalGet,PREWRITE_TS);
  checkAddLockAndDataFamily(internalGet,ColumnUtil.LOCK_FAMILY_NAME,FAMILY);
  Assert.assertTrue(internalGet.getFilter() instanceof ExcludeDataColumnFilter);
  userGet=new Get(ROW);
  userGet.addFamily(FAMILY);
  userGet.addColumn(ANOTHER_FAMILY,ANOTHER_QUALIFIER);
  internalGet=new Get(userGet.getRow());
  ThemisCpUtil.addLockAndWriteColumnToGet(userGet,internalGet,PREWRITE_TS);
  checkAddLockAndDataFamily(internalGet,ColumnUtil.LOCK_FAMILY_NAME,FAMILY);
  checkReadWithWriteColumns(internalGet.getFamilyMap(),new ColumnCoordinate(ANOTHER_FAMILY,ANOTHER_QUALIFIER));
}

Fixed version (ground truth):
@Test public void testAddLockAndWriteColumnToGet() throws IOException {
  byte[][] families=new byte[][]{FAMILY,FAMILY,ANOTHER_FAMILY};
  byte[][] qualifiers=new byte[][]{QUALIFIER,ANOTHER_FAMILY,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());
  Assert.assertEquals(4,internalGet.getFamilyMap().get(FAMILY).size());
  Assert.assertEquals(2,internalGet.getFamilyMap().get(ANOTHER_FAMILY).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());
  userGet=new Get(ROW);
  userGet.addFamily(FAMILY);
  internalGet=new Get(userGet.getRow());
  ThemisCpUtil.addLockAndWriteColumnToGet(userGet,internalGet,PREWRITE_TS);
  checkAddLockAndDataFamily(internalGet,ColumnUtil.LOCK_FAMILY_NAME,FAMILY);
  Assert.assertTrue(internalGet.getFilter() instanceof ExcludeDataColumnFilter);
  userGet=new Get(ROW);
  userGet.addFamily(ANOTHER_FAMILY);
  userGet.addColumn(FAMILY,ANOTHER_QUALIFIER);
  internalGet=new Get(userGet.getRow());
  ThemisCpUtil.addLockAndWriteColumnToGet(userGet,internalGet,PREWRITE_TS);
  checkAddLockAndDataFamily(internalGet,ColumnUtil.LOCK_FAMILY_NAME,ANOTHER_FAMILY);
  checkReadWithWriteColumns(internalGet.getFamilyMap(),new ColumnCoordinate(FAMILY,ANOTHER_QUALIFIER));
  Assert.assertTrue(internalGet.getFilter() instanceof ExcludeDataColumnFilter);
}