Program: 172137
Project: 172137
Buggy source:
private void configureBasicMockTransmitter(TransferProgress[] statuses){
  doAnswer(new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocation) throws Throwable {
      OutputStream os=(OutputStream)invocation.getArguments()[2];
      Writer writer=new OutputStreamWriter(os);
      XMLTransferRequsiteWriter requisiteWriter=new XMLTransferRequsiteWriter(writer);
      requisiteWriter.startTransferRequsite();
      requisiteWriter.missingContent(file1,ContentModel.PROP_CONTENT,TransferCommons.URLToPartName(file1ContentUrl));
      requisiteWriter.missingContent(file2,ContentModel.PROP_CONTENT,TransferCommons.URLToPartName(file2ContentUrl));
      requisiteWriter.missingContent(file3,ContentModel.PROP_CONTENT,TransferCommons.URLToPartName(file3ContentUrl));
      requisiteWriter.endTransferRequsite();
      writer.flush();
      writer.close();
      return null;
    }
  }
).when(mockedTransferTransmitter).sendManifest(any(Transfer.class),any(File.class),any(OutputStream.class));
  doAnswer(new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocation) throws Throwable {
      OutputStream os=(OutputStream)invocation.getArguments()[1];
      Writer writer=new OutputStreamWriter(os);
      XMLTransferDestinationReportWriter reportWriter=new XMLTransferDestinationReportWriter();
      reportWriter.startTransferReport("String_Node_Str",writer);
      reportWriter.writeComment("String_Node_Str");
      reportWriter.writeChangeState("String_Node_Str");
      reportWriter.writeCreated(file1,file1,folder1,new Path());
      reportWriter.writeDeleted(file3,file3,new Path());
      reportWriter.writeMoved(file2,file2,new Path(),folder1,new Path());
      reportWriter.endTransferReport();
      return null;
    }
  }
).when(mockedTransferTransmitter).getTransferReport(any(Transfer.class),any(OutputStream.class));
  if (statuses != null) {
    if (statuses.length > 1) {
      when(mockedTransferTransmitter.getStatus(transfer)).thenReturn(statuses[0],Arrays.copyOfRange(statuses,1,statuses.length));
    }
 else     if (statuses.length == 1) {
      when(mockedTransferTransmitter.getStatus(transfer)).thenReturn(statuses[0]);
    }
  }
}

Fixed version (ground truth):
private void configureBasicMockTransmitter(TransferProgress[] statuses){
  doAnswer(new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocation) throws Throwable {
      OutputStream os=(OutputStream)invocation.getArguments()[2];
      Writer writer=new OutputStreamWriter(os);
      XMLTransferRequsiteWriter requisiteWriter=new XMLTransferRequsiteWriter(writer);
      requisiteWriter.startTransferRequsite();
      requisiteWriter.missingContent(file1,ContentModel.PROP_CONTENT,TransferCommons.URLToPartName(file1ContentUrl));
      requisiteWriter.missingContent(file2,ContentModel.PROP_CONTENT,TransferCommons.URLToPartName(file2ContentUrl));
      requisiteWriter.missingContent(file3,ContentModel.PROP_CONTENT,TransferCommons.URLToPartName(file3ContentUrl));
      requisiteWriter.endTransferRequsite();
      writer.flush();
      writer.close();
      return null;
    }
  }
).when(mockedTransferTransmitter).sendManifest(any(Transfer.class),any(File.class),any(OutputStream.class));
  doAnswer(new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocation) throws Throwable {
      OutputStream os=(OutputStream)invocation.getArguments()[1];
      Writer writer=new OutputStreamWriter(os);
      XMLTransferDestinationReportWriter reportWriter=new XMLTransferDestinationReportWriter();
      reportWriter.startTransferReport("String_Node_Str",writer);
      reportWriter.writeComment("String_Node_Str");
      reportWriter.writeChangeState("String_Node_Str");
      reportWriter.writeCreated(file1,file1,folder1,"String_Node_Str");
      reportWriter.writeDeleted(file3,file3,"String_Node_Str");
      reportWriter.writeMoved(file2,file2,"String_Node_Str",folder1,"String_Node_Str");
      reportWriter.endTransferReport();
      return null;
    }
  }
).when(mockedTransferTransmitter).getTransferReport(any(Transfer.class),any(OutputStream.class));
  if (statuses != null) {
    if (statuses.length > 1) {
      when(mockedTransferTransmitter.getStatus(transfer)).thenReturn(statuses[0],Arrays.copyOfRange(statuses,1,statuses.length));
    }
 else     if (statuses.length == 1) {
      when(mockedTransferTransmitter.getStatus(transfer)).thenReturn(statuses[0]);
    }
  }
}