@Test
  public void testBlobIdIsEncrypted() throws Exception {
    for (boolean isEncrypted : TestUtils.BOOLEAN_VALUES) {
      BlobId blobId =
          new BlobId(version, random.nextBoolean() ? BlobIdType.NATIVE : BlobIdType.CRAFTED, (byte) 1, (short) 1,
              (short) 1, referenceClusterMap.getWritablePartitionIds(MockClusterMap.DEFAULT_PARTITION_CLASS)
              .get(random.nextInt(3)), isEncrypted, BlobDataType.DATACHUNK);
      if (version <= BLOB_ID_V2) {
        // V1 and V2 should always return false
        assertFalse("V" + version + " encrypted bit should be false", BlobId.isEncrypted(blobId.getID()));
      } else if (version == BLOB_ID_V3) {
        // V3 return False if encrypted is not set in the string of blobId; new blobIDV3s always set encrypted to false
        // regardless of the constructor argument.
        assertFalse("V3 encrypted bit should be false", BlobId.isEncrypted(blobId.getID()));

        // V3 should return true if blobIdString has encrypted bit
        assertTrue("V3 should return true if blobIdString has encrypted bit", BlobId.isEncrypted("AAME"));
        assertTrue("V3 should return true if blobIdString has encrypted bit", BlobId.isEncrypted("AAMF"));

        // V3 should return false if blobIdString has no encrypted
        assertFalse("V3 should return false if blobIdString has no encrypted", BlobId.isEncrypted("AAMA"));
        assertFalse("V3 should return false if blobIdString has no encrypted", BlobId.isEncrypted("AAMB"));
      } else {
        assertEquals("V" + version + " should return true or false based on its encrypted bit", isEncrypted,
            BlobId.isEncrypted(blobId.getID()));
      }
    }
  }
Test {@link BlobId#isEncrypted(String)}.
BLOB_ID_V1 and BLOB_ID_V2 encrypted bit should always be {@code false);
BLOB_ID_V3 encrypted bit can be {@code true}} if BlobIdString has encrypted bit;
BLOB_ID_V4 encrypted bit is based on {@link BlobId} only.
@throws Exception
ambry-commons/src/test/java/com/github/ambry/commons/BlobIdTest.java