@Test
  public void individualErrorCodesTest() throws Exception {
    Map<ServerErrorCode, RouterErrorCode> errorCodeMap = new HashMap<>();
    errorCodeMap.put(ServerErrorCode.BlobDeleted, RouterErrorCode.BlobDeleted);
    errorCodeMap.put(ServerErrorCode.BlobExpired, RouterErrorCode.BlobExpired);
    // In production, disk_unavailable usually means disk is bad with I/O errors. For now, the only way to fix this is
    // to replace disk and relies on replication to restore data. If all replicas return disk unavailable (should be
    // extremely rare in real world), it means blob is no long present and it's should be ok to return BlobDoesNotExist.
    // But for simplicity, we will return AmbryUnavailable. Once disks are replaced, we will begin to return
    // BlobDoesNotExist.
    errorCodeMap.put(ServerErrorCode.DiskUnavailable, RouterErrorCode.AmbryUnavailable);
    errorCodeMap.put(ServerErrorCode.ReplicaUnavailable, RouterErrorCode.AmbryUnavailable);
    errorCodeMap.put(ServerErrorCode.BlobUpdateNotAllowed, RouterErrorCode.BlobUpdateNotAllowed);
    errorCodeMap.put(ServerErrorCode.BlobAuthorizationFailure, RouterErrorCode.BlobAuthorizationFailure);
    for (ServerErrorCode errorCode : ServerErrorCode.values()) {
      if (errorCode == ServerErrorCode.NoError || errorCode == ServerErrorCode.BlobAlreadyUpdated) {
        continue;
      }
      ArrayList<ServerErrorCode> serverErrorCodes =
          new ArrayList<>(Collections.nCopies(serverCount, ServerErrorCode.IOError));
      // has to be repeated because the op tracker returns failure if it sees 8/9 failures and the success target is 2
      serverErrorCodes.set(3, errorCode);
      serverErrorCodes.set(5, errorCode);
      Collections.shuffle(serverErrorCodes);
      setServerErrorCodes(serverErrorCodes, serverLayout);
      RouterErrorCode expected = errorCodeMap.getOrDefault(errorCode, RouterErrorCode.UnexpectedInternalError);
      executeOpAndVerify(blobIds, expected, false, true, true, false, false);
    }
    serverLayout.getMockServers().forEach(MockServer::resetServerErrors);
    assertTtl(router, blobIds, TTL_SECS);
  }
Tests to make sure {@link ServerErrorCode}s map to the right {@link RouterErrorCode}.
@throws Exception
ambry-router/src/test/java/com/github/ambry/router/TtlUpdateManagerTest.java