private void assertBlobIdFieldValues(short version, BlobId blobId, BlobIdType type, byte datacenterId,
      short accountId, short containerId, PartitionId partitionId, boolean isEncrypted, BlobDataType blobDataType)
      throws Exception {
    assertTrue("Used unrecognized version", Arrays.asList(BlobId.getAllValidVersions()).contains(version));
    assertEquals("Wrong partition id in blobId: " + blobId, partitionId, blobId.getPartition());
    switch (version) {
      case BLOB_ID_V1:
        assertEquals("Wrong type in blobId: " + blobId, BlobIdType.NATIVE, blobId.getType());
        assertEquals("Wrong datacenter id in blobId: " + blobId, ClusterMap.UNKNOWN_DATACENTER_ID,
            blobId.getDatacenterId());
        assertEquals("Wrong account id in blobId: " + blobId, Account.UNKNOWN_ACCOUNT_ID, blobId.getAccountId());
        assertEquals("Wrong container id in blobId: " + blobId, Container.UNKNOWN_CONTAINER_ID,
            blobId.getContainerId());
        assertFalse("Wrong isEncrypted value in blobId: " + blobId, BlobId.isEncrypted(blobId.getID()));
        assertNull("Expected null blobDataType in blobId", blobId.getBlobDataType());
        break;
      case BLOB_ID_V2:
        assertEquals("Wrong type in blobId: " + blobId, BlobIdType.NATIVE, blobId.getType());
        assertEquals("Wrong datacenter id in blobId: " + blobId, datacenterId, blobId.getDatacenterId());
        assertEquals("Wrong account id in blobId: " + blobId, accountId, blobId.getAccountId());
        assertEquals("Wrong container id in blobId: " + blobId, containerId, blobId.getContainerId());
        assertFalse("Wrong isEncrypted value id in blobId: " + blobId, BlobId.isEncrypted(blobId.getID()));
        assertNull("Expected null blobDataType in blobId", blobId.getBlobDataType());
        break;
      case BLOB_ID_V3:
        assertEquals("Wrong type in blobId: " + blobId, type, blobId.getType());
        assertEquals("Wrong datacenter id in blobId: " + blobId, datacenterId, blobId.getDatacenterId());
        assertEquals("Wrong account id in blobId: " + blobId, accountId, blobId.getAccountId());
        assertEquals("Wrong container id in blobId: " + blobId, containerId, blobId.getContainerId());
        assertFalse("Wrong isEncrypted value id in blobId: " + blobId, BlobId.isEncrypted(blobId.getID()));
        assertNull("Expected null blobDataType in blobId", blobId.getBlobDataType());
        break;
      case BLOB_ID_V4:
        assertEquals("Wrong type in blobId: " + blobId, type, blobId.getType());
        assertEquals("Wrong datacenter id in blobId: " + blobId, datacenterId, blobId.getDatacenterId());
        assertEquals("Wrong account id in blobId: " + blobId, accountId, blobId.getAccountId());
        assertEquals("Wrong container id in blobId: " + blobId, containerId, blobId.getContainerId());
        assertEquals("Wrong isEncrypted value in blobId: " + blobId, isEncrypted, BlobId.isEncrypted(blobId.getID()));
        assertNull("Expected null blobDataType in blobId", blobId.getBlobDataType());
        break;
      case BLOB_ID_V5:
      case BLOB_ID_V6:
        assertEquals("Wrong type in blobId: " + blobId, type, blobId.getType());
        assertEquals("Wrong datacenter id in blobId: " + blobId, datacenterId, blobId.getDatacenterId());
        assertEquals("Wrong account id in blobId: " + blobId, accountId, blobId.getAccountId());
        assertEquals("Wrong container id in blobId: " + blobId, containerId, blobId.getContainerId());
        assertEquals("Wrong isEncrypted value in blobId: " + blobId, isEncrypted, BlobId.isEncrypted(blobId.getID()));
        assertEquals("Wrong blobDataType value in blobId: " + blobId, blobDataType, blobId.getBlobDataType());
        break;
      default:
        fail("Unrecognized version: " + version);
    }
    assertNotNull("getLongForm() should be supported for version: " + version, blobId.getLongForm());
    Pair<Short, Short> accountAndContainer = BlobId.getAccountAndContainerIds(blobId.getID());
    assertEquals("Account id from the id string should be the same as the associated account id", blobId.getAccountId(),
        (short) accountAndContainer.getFirst());
    assertEquals("Container id from the id string should be the same as the associated container id",
        blobId.getContainerId(), (short) accountAndContainer.getSecond());
    assertEquals("Unexpected version returned by BlobID.getVersion()", version, BlobId.getVersion(blobId.getID()));
  }
Asserts a {@link BlobId} against the expected values.
@param version The expected version of the blobId.
@param blobId The {@link BlobId} to assert.
@param type The expected {@link BlobIdType}.
@param datacenterId The expected {@code datacenterId}. This will be of no effect if version is set to v1, and the
                    expected value will become {@link ClusterMap#UNKNOWN_DATACENTER_ID}.
                    For v2, {@code null} will make the assertion against
                    {@link ClusterMap#UNKNOWN_DATACENTER_ID}.
@param accountId The expected {@code accountId}. This will be of no effect if version is set to v1, and the expected
                 value will become {@link Account#UNKNOWN_ACCOUNT_ID}. For v2, {@code null} will make the assertion
                 against {@link Account#UNKNOWN_ACCOUNT_ID}.
@param containerId The expected {@code containerId}. This will be of no effect if version is set to v1, and the
                   expected value will become {@link Container#UNKNOWN_CONTAINER_ID}. For v2, {@code null} will make
                   the assertion against {@link Container#UNKNOWN_CONTAINER_ID}.
@param partitionId The expected partitionId.
@param isEncrypted {@code true} expected {@code isEncrypted}. This will be of no effect if version is set to v1 and v2.
@throws Exception Any unexpected exception.
ambry-commons/src/test/java/com/github/ambry/commons/BlobIdTest.java