Program: 52970
Project: 52970
Buggy source:
@Test public void canUploadFiles() throws Exception {
  final List<Boolean> fileExistence=Arrays.asList(true,false,true);
  Capture<FrontendRequest> containsRequest=EasyMock.newCapture();
  FrontendResponse containsResponse=new FrontendResponse();
  containsResponse.setType(FrontendRequestType.CAS_CONTAINS);
  CASContainsResponse casContainsResponse=new CASContainsResponse();
  casContainsResponse.setExists(fileExistence);
  containsResponse.setCasContainsResponse(casContainsResponse);
  containsResponse.setWasSuccessful(true);
  EasyMock.expect(frontendService.makeRequest(EasyMock.capture(containsRequest))).andReturn(containsResponse).once();
  Capture<FrontendRequest> storeRequest=EasyMock.newCapture();
  FrontendResponse storeResponse=new FrontendResponse();
  storeResponse.setType(FrontendRequestType.STORE_LOCAL_CHANGES);
  storeResponse.setWasSuccessful(true);
  EasyMock.expect(frontendService.makeRequest(EasyMock.capture(storeRequest))).andReturn(storeResponse).once();
  EasyMock.replay(frontendService);
  BuildJobStateFileHashEntry files[]=new BuildJobStateFileHashEntry[3];
  for (int i=0; i < 3; i++) {
    files[i]=new BuildJobStateFileHashEntry();
    files[i].setHashCode(Integer.toString(i));
    files[i].setContents(("String_Node_Str" + Integer.toString(i)).getBytes());
    files[i].setPath(new PathWithUnixSeparators("String_Node_Str" + i));
  }
  List<BuildJobStateFileHashes> fileHashes=new ArrayList<>();
  fileHashes.add(new BuildJobStateFileHashes());
  fileHashes.get(0).setCellIndex(0);
  fileHashes.get(0).setEntries(new ArrayList<BuildJobStateFileHashEntry>());
  fileHashes.get(0).getEntries().add(files[0]);
  fileHashes.get(0).getEntries().add(files[1]);
  fileHashes.add(new BuildJobStateFileHashes());
  fileHashes.get(1).setCellIndex(1);
  fileHashes.get(1).setEntries(new ArrayList<BuildJobStateFileHashEntry>());
  fileHashes.get(1).getEntries().add(files[2]);
  distBuildService.uploadMissingFilesAsync(fileHashes,executor).get();
  Assert.assertEquals(containsRequest.getValue().getType(),FrontendRequestType.CAS_CONTAINS);
  Assert.assertTrue(containsRequest.getValue().isSetCasContainsRequest());
  Assert.assertTrue(containsRequest.getValue().getCasContainsRequest().isSetContentSha1s());
  Assert.assertEquals(new HashSet<String>(containsRequest.getValue().getCasContainsRequest().getContentSha1s()),new HashSet<String>(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str")));
  Assert.assertEquals(storeRequest.getValue().getType(),FrontendRequestType.STORE_LOCAL_CHANGES);
  Assert.assertTrue(storeRequest.getValue().isSetStoreLocalChangesRequest());
  Assert.assertTrue(storeRequest.getValue().getStoreLocalChangesRequest().isSetFiles());
  Assert.assertEquals(storeRequest.getValue().getStoreLocalChangesRequest().getFiles().size(),1);
  Assert.assertEquals(storeRequest.getValue().getStoreLocalChangesRequest().getFiles().get(0).getContentHash(),"String_Node_Str");
  Assert.assertTrue(Arrays.equals(storeRequest.getValue().getStoreLocalChangesRequest().getFiles().get(0).getContent(),"String_Node_Str".getBytes()));
}

Fixed version (ground truth):
@Test public void canUploadFiles() throws Exception {
  final List<Boolean> fileExistence=Arrays.asList(true,false,true);
  Capture<FrontendRequest> containsRequest=EasyMock.newCapture();
  FrontendResponse containsResponse=new FrontendResponse();
  containsResponse.setType(FrontendRequestType.CAS_CONTAINS);
  CASContainsResponse casContainsResponse=new CASContainsResponse();
  casContainsResponse.setExists(fileExistence);
  containsResponse.setCasContainsResponse(casContainsResponse);
  containsResponse.setWasSuccessful(true);
  EasyMock.expect(frontendService.makeRequest(EasyMock.capture(containsRequest))).andReturn(containsResponse).once();
  Capture<FrontendRequest> storeRequest=EasyMock.newCapture();
  FrontendResponse storeResponse=new FrontendResponse();
  storeResponse.setType(FrontendRequestType.STORE_LOCAL_CHANGES);
  storeResponse.setWasSuccessful(true);
  EasyMock.expect(frontendService.makeRequest(EasyMock.capture(storeRequest))).andReturn(storeResponse).once();
  EasyMock.replay(frontendService);
  BuildJobStateFileHashEntry files[]=new BuildJobStateFileHashEntry[3];
  for (int i=0; i < 3; i++) {
    files[i]=new BuildJobStateFileHashEntry();
    files[i].setHashCode(Integer.toString(i));
    files[i].setContents(("String_Node_Str" + Integer.toString(i)).getBytes());
    files[i].setPath(new PathWithUnixSeparators().setPath("String_Node_Str" + i));
  }
  List<BuildJobStateFileHashes> fileHashes=new ArrayList<>();
  fileHashes.add(new BuildJobStateFileHashes());
  fileHashes.get(0).setCellIndex(0);
  fileHashes.get(0).setEntries(new ArrayList<BuildJobStateFileHashEntry>());
  fileHashes.get(0).getEntries().add(files[0]);
  fileHashes.get(0).getEntries().add(files[1]);
  fileHashes.add(new BuildJobStateFileHashes());
  fileHashes.get(1).setCellIndex(1);
  fileHashes.get(1).setEntries(new ArrayList<BuildJobStateFileHashEntry>());
  fileHashes.get(1).getEntries().add(files[2]);
  distBuildService.uploadMissingFilesAsync(fileHashes,executor).get();
  Assert.assertEquals(containsRequest.getValue().getType(),FrontendRequestType.CAS_CONTAINS);
  Assert.assertTrue(containsRequest.getValue().isSetCasContainsRequest());
  Assert.assertTrue(containsRequest.getValue().getCasContainsRequest().isSetContentSha1s());
  Assert.assertEquals(new HashSet<String>(containsRequest.getValue().getCasContainsRequest().getContentSha1s()),new HashSet<String>(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str")));
  Assert.assertEquals(storeRequest.getValue().getType(),FrontendRequestType.STORE_LOCAL_CHANGES);
  Assert.assertTrue(storeRequest.getValue().isSetStoreLocalChangesRequest());
  Assert.assertTrue(storeRequest.getValue().getStoreLocalChangesRequest().isSetFiles());
  Assert.assertEquals(storeRequest.getValue().getStoreLocalChangesRequest().getFiles().size(),1);
  Assert.assertEquals(storeRequest.getValue().getStoreLocalChangesRequest().getFiles().get(0).getContentHash(),"String_Node_Str");
  Assert.assertTrue(Arrays.equals(storeRequest.getValue().getStoreLocalChangesRequest().getFiles().get(0).getContent(),"String_Node_Str".getBytes()));
}