@Test
  public void testSerDes() throws Exception {
    BlobId blobId = new BlobId(version, referenceType, referenceDatacenterId, referenceAccountId, referenceContainerId,
        referencePartitionId, referenceIsEncrypted, referenceDataType);
    deserializeBlobIdAndAssert(version, blobId.getID());
    BlobId blobIdSerDed =
        new BlobId(new DataInputStream(new ByteArrayInputStream(blobId.toBytes())), referenceClusterMap);
    // Ensure that deserialized blob is exactly the same as the original in comparisons.
    assertTrue(blobId.equals(blobIdSerDed));
    assertTrue(blobIdSerDed.equals(blobId));
    assertEquals(blobId.hashCode(), blobIdSerDed.hashCode());
    assertEquals(0, blobId.compareTo(blobIdSerDed));
    assertEquals(0, blobIdSerDed.compareTo(blobId));
  }
Tests first serializing a blobId into string, and then deserializing into a blobId object from the string.
@throws Exception Any unexpected exception.
ambry-commons/src/test/java/com/github/ambry/commons/BlobIdTest.java