@Test
  public void failureTest() {
    initialize();
    UndeleteOperationTracker tracker = getOperationTracker(3);
    sendRequests(tracker, 3);
    // First 3 requests should target at local datacenter, fail two of them should fail the operation
    for (int i = 0; i < 2; i++) {
      ReplicaId replicaId = inflightReplicas.poll();
      assertEquals(replicaId.getDataNodeId().getDatacenterName(), localDcName);
      tracker.onResponse(replicaId, TrackedRequestFinalState.FAILURE);
    }
    assertTrue("Operation should have failed", tracker.hasFailed());
    assertTrue("Operation should be done", tracker.isDone());
    assertFalse("Operation should not have succeeded", tracker.hasSucceeded());
  }
Tests when there are two failures in one datacenter.
ambry-router/src/test/java/com/github/ambry/router/UndeleteOperationTrackerTest.java