private String buildBadBlobId(short version, BlobIdType type, Byte datacenterId, Short accountId, Short containerId,
      PartitionId partitionId, int uuidLength, String uuid, String extraChars) {
    int idLength;
    ByteBuffer idBuf;
    switch (version) {
      case BLOB_ID_V1:
        idLength = 2 + partitionId.getBytes().length + 4 + uuid.length() + extraChars.length();
        idBuf = ByteBuffer.allocate(idLength);
        idBuf.putShort(version);
        break;
      case BLOB_ID_V2:
        idLength = 2 + 1 + 1 + 2 + 2 + partitionId.getBytes().length + 4 + uuid.length() + extraChars.length();
        idBuf = ByteBuffer.allocate(idLength);
        idBuf.putShort(version);
        idBuf.put((byte) 0);
        idBuf.put(datacenterId);
        idBuf.putShort(accountId);
        idBuf.putShort(containerId);
        break;
      case BLOB_ID_V3:
      case BLOB_ID_V4:
      case BLOB_ID_V5:
      case BLOB_ID_V6:
        idLength = 2 + 1 + 1 + 2 + 2 + partitionId.getBytes().length + 4 + uuid.length() + extraChars.length();
        idBuf = ByteBuffer.allocate(idLength);
        idBuf.putShort(version);
        idBuf.put((byte) type.ordinal());
        idBuf.put(datacenterId);
        idBuf.putShort(accountId);
        idBuf.putShort(containerId);
        break;
      default:
        idLength = 2 + partitionId.getBytes().length + 4 + uuid.length() + extraChars.length();
        idBuf = ByteBuffer.allocate(idLength);
        idBuf.putShort(version);
        break;
    }
    idBuf.put(partitionId.getBytes());
    switch (version) {
      case BLOB_ID_V6:
        UUID uuidObj = UUID.fromString(uuid);
        idBuf.putLong(uuidObj.getMostSignificantBits());
        idBuf.putLong(uuidObj.getLeastSignificantBits());
        break;
      default:
        idBuf.putInt(uuidLength);
        idBuf.put(uuid.getBytes());
    }
    idBuf.put(extraChars.getBytes());
    return Base64.encodeBase64URLSafeString(idBuf.array());
  }
Build a string that resembles a bad blobId.
@param version The version number to be embedded in the blobId.
@param type The {@link BlobIdType} of the blobId.
@param datacenterId The datacenter id to be embedded in the blobId.
@param accountId The account id to be embedded in the blobId.
@param containerId The container id to be embedded in the blobId.
@param partitionId The partition id to be embedded in the blobId.
@param uuidLength The length of the uuid.
@param uuid The UUID to be embedded in the blobId.
@param extraChars Extra characters to put at the end of the ID.
@return a base-64 encoded {@link String} representing the blobId.
ambry-commons/src/test/java/com/github/ambry/commons/BlobIdTest.java