@Test
  public void testErrorPrecedenceWithOrigDcUnavailability() throws Exception {
    // Default all replicas to return not found.
    int serverCount = serverLayout.getMockServers().size();
    List<ServerErrorCode> serverErrorCodes = Collections.nCopies(serverCount, ServerErrorCode.BlobNotFound);
    setServerErrorCodes(serverErrorCodes, serverLayout);

    // Set 1 not found from bootstrap, 2 not found from standby in originating dc
    List<MockServer> serversInLocalDc = new ArrayList<>();
    serverLayout.getMockServers().forEach(mockServer -> {
      if (mockServer.getDataCenter().equals(localDc)) {
        serversInLocalDc.add(mockServer);
      }
    });
    for (String blob : blobIds) {
      BlobId blobId = RouterUtils.getBlobIdFromString(blob, clusterMap);
      MockPartitionId partitionId = (MockPartitionId) blobId.getPartition();
      ReplicaId boostrapReplica = partitionId.replicaIds.stream()
          .filter(replicaId -> replicaId.getDataNodeId().getDatacenterName().equals(localDc))
          .filter(replicaId -> replicaId.getDataNodeId().getHostname().equals(serversInLocalDc.get(0).getHostName()))
          .findFirst()
          .get();
      partitionId.setReplicaState(boostrapReplica, ReplicaState.BOOTSTRAP);
    }
    serversInLocalDc.get(0).setServerErrorForAllRequests(ServerErrorCode.BlobNotFound);
    serversInLocalDc.get(1).setServerErrorForAllRequests(ServerErrorCode.BlobNotFound);
    serversInLocalDc.get(2).setServerErrorForAllRequests(ServerErrorCode.BlobNotFound);

    // Set two remote servers to return Blob_Update_Not_Allowed
    List<MockServer> serversInRemoteDc = new ArrayList<>(serverLayout.getMockServers());
    serversInRemoteDc.removeAll(serversInLocalDc);
    serversInRemoteDc.get(0).setServerErrorForAllRequests(ServerErrorCode.BlobUpdateNotAllowed);
    serversInRemoteDc.get(1).setServerErrorForAllRequests(ServerErrorCode.BlobUpdateNotAllowed);

    executeOpAndVerify(blobIds, RouterErrorCode.BlobUpdateNotAllowed, false, true, true, false, false);
  }
Test the case when error precedence is maintained with unavailability in originating DC.
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/TtlUpdateManagerTest.java