@Test
  public void testBlobRecordWithMetadataContentV3() throws IOException, MessageFormatException {
    int numKeys = 5;
    List<StoreKey> keys = getKeys(60, numKeys);
    List<Pair<StoreKey, Long>> keysAndContentSizes = new ArrayList<>();
    long total = 0;
    for (int i = 0; i < numKeys; i++) {
      long randNum = ThreadLocalRandom.current().nextLong(1, 10000000);
      total += randNum;
      keysAndContentSizes.add(new Pair<>(keys.get(i), randNum));
    }

    ByteBuffer metadataContent = getSerializedMetadataContentV3(total, keysAndContentSizes);
    int metadataContentSize =
        MessageFormatRecord.Metadata_Content_Format_V3.getMetadataContentSize(keys.get(0).sizeInBytes(), keys.size());
    long blobSize = MessageFormatRecord.Blob_Format_V3.getBlobRecordSize(metadataContentSize);
    ByteBuffer blob = ByteBuffer.allocate((int) blobSize);
    BlobData blobData = getBlobRecordV3(metadataContentSize, BlobType.MetadataBlob, metadataContent, blob);
    Assert.assertEquals(metadataContentSize, blobData.getSize());
    byte[] verify = new byte[metadataContentSize];
    blobData.content().readBytes(verify);
    Assert.assertArrayEquals("Metadata content mismatch", metadataContent.array(), verify);
    blobData.release();

    metadataContent.rewind();
    CompositeBlobInfo compositeBlobInfo = deserializeMetadataContentV3(metadataContent, new MockIdFactory());
    Assert.assertEquals("Total size doesn't match", total, compositeBlobInfo.getTotalSize());
    Assert.assertEquals("List of keys dont match", keys, compositeBlobInfo.getKeys());
    List<CompositeBlobInfo.ChunkMetadata> list = compositeBlobInfo.getChunkMetadataList();
    Assert.assertEquals("ChunkMetadata and input list have different sizes", list.size(), keysAndContentSizes.size());
    long sum = 0;
    for (int i = 0; i < list.size(); i++) {
      Assert.assertEquals(keysAndContentSizes.get(i).getFirst(), list.get(i).getStoreKey());
      Assert.assertEquals((long) keysAndContentSizes.get(i).getSecond(), list.get(i).getSize());
      Assert.assertEquals(sum, list.get(i).getOffset());
      sum += list.get(i).getSize();
    }
  }
Serializes the blob content using BlobRecord Verison 2 with the passsed in params
De-serialized the blob returns the {@link BlobData} for the same
@param blobSize
@param blobType
@param blobContent
@param outputBuffer
@return
@throws IOException
@throws MessageFormatException
ambry-messageformat/src/test/java/com/github/ambry/messageformat/MessageFormatRecordTest.java