@Test
  public void replicaNotFoundFailureTest() throws Exception {
    // get another partition that is not present in ReplicaSyncUpManager
    PartitionId partition = clusterMap.getAllPartitionIds(null).get(1);
    ReplicaId replicaToTest = partition.getReplicaIds().get(0);
    ReplicaId peerReplica = replicaToTest.getPeerReplicaIds().get(0);
    try {
      replicaSyncUpService.isSyncUpComplete(replicaToTest);
      fail("should fail because replica is not present in ReplicaSyncUpManager");
    } catch (IllegalStateException e) {
      // expected
    }
    assertFalse("Updating lag should return false because replica is not present",
        replicaSyncUpService.updateReplicaLagAndCheckSyncStatus(replicaToTest, peerReplica, 100L,
            ReplicaState.STANDBY));
    try {
      replicaSyncUpService.onBootstrapError(replicaToTest);
      fail("should fail because replica is not present");
    } catch (IllegalStateException e) {
      // expected
    }
    // wait for bootstrap to complete should be no op
    replicaSyncUpService.waitBootstrapCompleted(partition.toPathString());
    replicaSyncUpService.reset();
  }
Test several failure cases where replica is not present in ReplicaSyncUpManager.
@throws Exception
ambry-clustermap/src/test/java/com/github/ambry/clustermap/AmbryReplicaSyncUpManagerTest.java