@Test
  public void testFileCopyThreadHandlerFailure() {
    final Map<String, Integer> successFailCount = new HashMap<>();
    successFailCount.putIfAbsent("success", 0);
    successFailCount.putIfAbsent("fail", 0);
    FileCopyHandler fileCopyHandler = new MockFileCopyHandlerFactory().getFileCopyHandler();
    ((MockNoOpFileCopyHandler) fileCopyHandler).setException(new Exception());
    Thread fileCopyThreadThread = getThread(successFailCount, fileCopyHandler);

    fileCopyThreadThread.start();
    try {
      fileCopyThreadThread.join();
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    assertEquals(0, successFailCount.get("success").intValue());
    assertEquals(1, successFailCount.get("fail").intValue());
  }
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