@Test
  public void testBlobIdFlag() throws Exception {
    boolean[] isEncryptedValues = {true, false};
    if (version >= BLOB_ID_V3) {
      for (BlobIdType type : BlobIdType.values()) {
        for (boolean isEncrypted : isEncryptedValues) {
          BlobId blobId = new BlobId(version, type, referenceDatacenterId, referenceAccountId, referenceContainerId,
              referencePartitionId, isEncrypted, referenceDataType);
          BlobId blobIdSerDed =
              new BlobId(new DataInputStream(new ByteArrayInputStream(blobId.toBytes())), referenceClusterMap);
          assertEquals("The type should match the original's type", type, blobIdSerDed.getType());
          assertEquals("The isEncrypted should match the original", version != BLOB_ID_V3 && isEncrypted,
              BlobId.isEncrypted(blobId.getID()));
        }
      }
    }

    if (version >= BLOB_ID_V5) {
      for (BlobDataType dataType : BlobDataType.values()) {
        BlobId blobId =
            new BlobId(version, BlobIdType.NATIVE, referenceDatacenterId, referenceAccountId, referenceContainerId,
                referencePartitionId, false, dataType);
        BlobId blobIdSerDed =
            new BlobId(new DataInputStream(new ByteArrayInputStream(blobId.toBytes())), referenceClusterMap);
        assertEquals("The data type should match the original's", dataType, blobIdSerDed.getBlobDataType());
      }
    }
  }
Test that the BlobId flag is honored by V3 and above.
@throws Exception
ambry-commons/src/test/java/com/github/ambry/commons/BlobIdTest.java