Program: 172029
Project: 172029
Buggy source:
@Test public void testJobInClusterLocked() throws Exception {
  JobExecutionContext mockJobExecutionContext=mock(JobExecutionContext.class);
  JobDetail jobDetail=new JobDetail();
  when(mockJobExecutionContext.getJobDetail()).thenReturn(jobDetail);
  SimpleHBDataCollector simpleCollector=spy(new SimpleHBDataCollector("String_Node_Str"));
  JobDataMap jobDataMap=new JobDataMap();
  jobDataMap.put("String_Node_Str",simpleCollector);
  jobDataMap.put("String_Node_Str",mockDataSenderService);
  jobDataMap.put("String_Node_Str",mockJobLockService);
  jobDetail.setJobDataMap(jobDataMap);
  String lockToken="String_Node_Str";
  Runnable r1=() -> {
    when(mockJobLockService.getLock(isA(QName.class),anyLong())).thenReturn(lockToken).thenThrow(new LockAcquisitionException("String_Node_Str","String_Node_Str"));
    try {
      new HeartBeatJob().execute(mockJobExecutionContext);
    }
 catch (    JobExecutionException e) {
    }
 finally {
      when(mockJobLockService.getLock(isA(QName.class),anyLong())).thenReturn(lockToken);
    }
  }
;
  Runnable r2=() -> {
    try {
      new HeartBeatJob().execute(mockJobExecutionContext);
    }
 catch (    JobExecutionException e) {
    }
  }
;
  Thread t1=new Thread(r1);
  Thread t2=new Thread(r2);
  t1.start();
  Thread.sleep(1000);
  t2.start();
  Thread.sleep(6000);
  verify(simpleCollector,Mockito.times(1)).collectData();
  verify(mockDataSenderService,Mockito.times(1)).sendData(any(List.class));
  verify(mockDataSenderService,Mockito.times(0)).sendData(any(HBData.class));
  verify(mockJobLockService,Mockito.times(2)).getLock(any(QName.class),anyLong());
  verify(mockJobLockService,Mockito.times(1)).refreshLock(eq(lockToken),any(QName.class),anyLong(),any(JobLockService.JobLockRefreshCallback.class));
  verify(mockJobLockService,Mockito.times(1)).releaseLock(eq(lockToken),any(QName.class));
}

Fixed version (ground truth):
@Test public void testJobInClusterLocked() throws Exception {
  JobExecutionContext mockJobExecutionContext=mock(JobExecutionContext.class);
  JobDetail jobDetail=new JobDetail();
  when(mockJobExecutionContext.getJobDetail()).thenReturn(jobDetail);
  SimpleHBDataCollector simpleCollector=spy(new SimpleHBDataCollector("String_Node_Str"));
  JobDataMap jobDataMap=new JobDataMap();
  jobDataMap.put("String_Node_Str",simpleCollector);
  jobDataMap.put("String_Node_Str",mockDataSenderService);
  jobDataMap.put("String_Node_Str",mockJobLockService);
  jobDetail.setJobDataMap(jobDataMap);
  String lockToken="String_Node_Str";
  Runnable r1=() -> {
    when(mockJobLockService.getLock(isA(QName.class),anyLong())).thenReturn(lockToken).thenThrow(new LockAcquisitionException("String_Node_Str","String_Node_Str"));
    try {
      new HeartBeatJob().execute(mockJobExecutionContext);
    }
 catch (    JobExecutionException e) {
    }
 finally {
      when(mockJobLockService.getLock(isA(QName.class),anyLong())).thenReturn(lockToken);
    }
  }
;
  Runnable r2=() -> {
    try {
      new HeartBeatJob().execute(mockJobExecutionContext);
    }
 catch (    JobExecutionException e) {
    }
  }
;
  Thread t1=new Thread(r1);
  Thread t2=new Thread(r2);
  t1.start();
  Thread.sleep(1000);
  t2.start();
  Thread.sleep(6000);
  verify(simpleCollector,Mockito.times(1)).collectData();
  verify(mockDataSenderService,Mockito.times(1)).sendData(any(List.class));
  verify(mockDataSenderService,Mockito.times(0)).sendData(any(HBData.class));
  verify(mockJobLockService,Mockito.times(2)).getLock(any(QName.class),anyLong());
  verify(mockJobLockService,Mockito.times(1)).refreshLock(eq(lockToken),any(QName.class),anyLong(),any(JobLockService.JobLockRefreshCallback.class));
}