@Test
  public void testNoFinalOperation() {
    BatchOperationCallbackTracker tracker =
        new BatchOperationCallbackTracker(chunkIds, new FutureResult<>(), callback, quotaChargeCallback, null, router);

    // update all data chunks and ensure that tracker isn't marked as complete.
    for (int i = 0; i < NUM_CHUNKS; i++) {
      tracker.getCallback(chunkIds.get(i)).onCompletion(null, null);
      if (i == NUM_CHUNKS - 1) {
        Assert.assertTrue(tracker.isCompleted());
        Assert.assertNull(trackerException);
      } else {
        Assert.assertFalse(tracker.isCompleted());
      }
    }
  }
Test that if a data chunk has exception, the operation is completed and finalOperation is never attempted.
ambry-router/src/test/java/com/github/ambry/router/BatchOperationCallbackTrackerTest.java