private static Thread getThread(Map<String, Integer> successFailCount, FileCopyHandler fileCopyHandler) {
    FileCopyStatusListener fileCopyStatusListener = new FileCopyStatusListener() {
      @Override
      public void onFileCopySuccess() {
        successFailCount.put("success", successFailCount.get("success") + 1);
      }

      @Override
      public ReplicaId getReplicaId() {
        MockClusterMap mockClusterMap = null;
        try {
          mockClusterMap = new MockClusterMap(false, true, 1,
              10, 3, false,
              false, null);
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        MockPartitionId partitionId = new MockPartitionId(1L, mockClusterMap.DEFAULT_PARTITION_CLASS,
            mockClusterMap.getDataNodes(), 0);
        return partitionId.getReplicaIds().get(0);
      }

      @Override
      public void onFileCopyFailure(Exception e) {
        successFailCount.put("fail", successFailCount.get("fail") + 1);
      }
    };

    FileCopyThread fileCopyThread = new FileCopyThread(fileCopyHandler, fileCopyStatusListener);
    Thread fileCopyThreadThread = new Thread(fileCopyThread);
    return fileCopyThreadThread;
  }
Tests when fileCopyHandler is failed and onFileCopyFailure is called.
and onFileCopySuccess is not called
ambry-file-transfer/src/test/java/com/github/ambry/filetransfer/FileCopyThreadTest.java