Program: 29936
Project: 29936
Buggy source:
@Test public void testScanWithLockClean() throws Exception {
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(false);
  prepareScanData(TRANSACTION_COLUMNS);
  writeLockAndData(COLUMN,prewriteTs - 5);
  ThemisScan pScan=prepareScan(TRANSACTION_COLUMNS);
  pScan.setCaching(10);
  ThemisScanner scanner=transaction.getScanner(TABLENAME,pScan);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
  writeLockAndData(COLUMN,prewriteTs - 4);
  scanner=transaction.getScanner(TABLENAME,pScan);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(true);
  try {
    scanner.next();
    Assert.fail();
  }
 catch (  LockConflictException e) {
  }
 finally {
    scanner.close();
  }
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW).addFamily(ANOTHER_FAMILY));
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_FAMILY},scanner.next());
  checkAndCloseScanner(scanner);
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW).addFamily(FAMILY));
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(true);
  try {
    scanner.next();
    Assert.fail();
  }
 catch (  LockConflictException e) {
  }
 finally {
    scanner.close();
  }
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW));
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(true);
  try {
    scanner.next();
    Assert.fail();
  }
 catch (  LockConflictException e) {
  }
 finally {
    scanner.close();
  }
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW));
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(false);
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
}

Fixed version (ground truth):
@Test public void testScanWithLockClean() throws Exception {
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(false);
  prepareScanData(TRANSACTION_COLUMNS);
  writeLockAndData(COLUMN,prewriteTs - 5);
  ThemisScan pScan=prepareScan(TRANSACTION_COLUMNS);
  pScan.setCaching(10);
  ThemisScanner scanner=transaction.getScanner(TABLENAME,pScan);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
  writeLockAndData(COLUMN,prewriteTs - 4);
  scanner=transaction.getScanner(TABLENAME,pScan);
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW},scanner.next());
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(true);
  try {
    scanner.next();
    Assert.fail();
  }
 catch (  LockConflictException e) {
  }
 finally {
    scanner.close();
  }
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW).addFamily(ANOTHER_FAMILY));
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_FAMILY},scanner.next());
  checkAndCloseScanner(scanner);
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW).addFamily(FAMILY));
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(true);
  try {
    scanner.next();
    Assert.fail();
  }
 catch (  LockConflictException e) {
  }
 finally {
    scanner.close();
  }
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW).addFamily(ANOTHER_FAMILY).addColumn(FAMILY,ANOTHER_QUALIFIER));
  checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_FAMILY,COLUMN_WITH_ANOTHER_QUALIFIER},scanner.next());
  checkAndCloseScanner(scanner);
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW));
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(true);
  try {
    scanner.next();
    Assert.fail();
  }
 catch (  LockConflictException e) {
  }
 finally {
    scanner.close();
  }
  scanner=transaction.getScanner(TABLENAME,new ThemisScan(ROW,ROW));
  Mockito.when(mockRegister.isWorkerAlive(TestBase.CLIENT_TEST_ADDRESS)).thenReturn(false);
  checkResultForROW(scanner.next());
  checkAndCloseScanner(scanner);
}