Program: 89991
Project: 89991
Buggy source:
/** 
 * Test the coordinate job method.
 * @throws GenieException If there is any problem
 */
@Test(expected=GeniePreconditionException.class) public void cantCoordinateJobIfNoClustersSelected() throws GenieException {
  final Set<String> commandCriteria=Sets.newHashSet();
  final JobRequest jobRequest=this.getJobRequest(true,commandCriteria,null,null);
  final JobMetadata jobMetadata=this.getJobMetadata();
  Mockito.when(this.clusterService.chooseClusterForJobRequest(jobRequest)).thenReturn(Lists.newArrayList(Mockito.mock(Cluster.class),Mockito.mock(Cluster.class)));
  Mockito.verifyNoMoreInteractions(selectApplicationTimer,selectApplicationTimerId,selectClusterTimer,selectClusterTimerId,setJobEnvironmentTimer,setJobEnvironmentTimerId);
  try {
    this.jobCoordinatorService.coordinateJob(jobRequest,jobMetadata);
  }
  finally {
    Mockito.verify(this.coordinationTimer,Mockito.times(1)).record(Mockito.anyLong(),Mockito.eq(TimeUnit.NANOSECONDS));
    Mockito.verify(this.coordinationTimerId,Mockito.times(1)).withTags(MetricsUtils.newFailureTagsMapForException(new GeniePreconditionException("String_Node_Str")));
    Mockito.verify(this.noClusterSelectedCounter,Mockito.times(1)).increment();
    Mockito.verify(this.loadBalancerCounterId,Mockito.times(4)).withTags(tagsCaptor.capture());
    final String className=(String)tagsCaptor.getValue().get(MetricsConstants.TagKeys.CLASS_NAME);
    Assert.assertNotNull(className);
    Assert.assertTrue(className.startsWith("String_Node_Str"));
    final String status=(String)tagsCaptor.getValue().get(MetricsConstants.TagKeys.STATUS);
    Assert.assertEquals("String_Node_Str",status);
    Mockito.verify(this.loadBalancerCounter,Mockito.times(4)).increment();
    Mockito.verify(this.selectClusterTimer,Mockito.times(1)).record(Mockito.anyLong(),Mockito.eq(TimeUnit.NANOSECONDS));
    Mockito.verify(this.selectClusterTimerId,Mockito.times(1)).withTags(MetricsUtils.newFailureTagsMapForException(new GeniePreconditionException("String_Node_Str")));
  }
}

Fixed version (ground truth):
/** 
 * Test the coordinate job method.
 * @throws GenieException If there is any problem
 */
@Test(expected=GeniePreconditionException.class) public void cantCoordinateJobIfNoClustersSelected() throws GenieException {
  final Set<String> commandCriteria=Sets.newHashSet();
  final JobRequest jobRequest=this.getJobRequest(true,commandCriteria,null,null);
  final JobMetadata jobMetadata=this.getJobMetadata();
  Mockito.when(this.clusterService.chooseClusterForJobRequest(jobRequest)).thenReturn(Lists.newArrayList(Mockito.mock(Cluster.class),Mockito.mock(Cluster.class)));
  Mockito.verifyNoMoreInteractions(selectApplicationTimer,selectApplicationTimerId,selectClusterTimer,selectClusterTimerId,setJobEnvironmentTimer,setJobEnvironmentTimerId);
  try {
    this.jobCoordinatorService.coordinateJob(jobRequest,jobMetadata);
  }
  finally {
    Mockito.verify(this.coordinationTimer,Mockito.times(1)).record(Mockito.anyLong(),Mockito.eq(TimeUnit.NANOSECONDS));
    Mockito.verify(this.coordinationTimerId,Mockito.times(1)).withTags(MetricsUtils.newFailureTagsMapForException(new GeniePreconditionException("String_Node_Str")));
    Mockito.verify(this.noClusterSelectedCounter,Mockito.times(1)).increment();
    Mockito.verify(this.loadBalancerCounterId,Mockito.times(4)).withTags(tagsCaptor.capture());
    final String className=this.tagsCaptor.getValue().get(MetricsConstants.TagKeys.CLASS_NAME);
    Assert.assertNotNull(className);
    Assert.assertTrue(className.startsWith("String_Node_Str"));
    final String status=this.tagsCaptor.getValue().get(MetricsConstants.TagKeys.STATUS);
    Assert.assertEquals("String_Node_Str",status);
    Mockito.verify(this.loadBalancerCounter,Mockito.times(4)).increment();
    Mockito.verify(this.selectClusterTimer,Mockito.times(1)).record(Mockito.anyLong(),Mockito.eq(TimeUnit.NANOSECONDS));
    Mockito.verify(this.selectClusterTimerId,Mockito.times(1)).withTags(MetricsUtils.newFailureTagsMapForException(new GeniePreconditionException("String_Node_Str")));
  }
}