@Test
  public void testBlobRecordWithMetadataContentV2() throws IOException, MessageFormatException {
    // Test Blob V3 with actual metadata blob V2
    // construct metadata blob
    List<StoreKey> keys = getKeys(60, 5);
    int[] chunkSizes = {ThreadLocalRandom.current().nextInt(1, Integer.MAX_VALUE), 15};
    long[] totalSizes = {(long) keys.size() * chunkSizes[0], ((long) keys.size() * chunkSizes[1]) - 11};
    for (int i = 0; i < chunkSizes.length; i++) {
      ByteBuffer metadataContent = getSerializedMetadataContentV2(chunkSizes[i], totalSizes[i], keys);
      int metadataContentSize =
          MessageFormatRecord.Metadata_Content_Format_V2.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();

      // deserialize and check for metadata contents
      metadataContent.rewind();
      CompositeBlobInfo compositeBlobInfo = deserializeMetadataContentV2(metadataContent, new MockIdFactory());
      Assert.assertEquals("Chunk size doesn't match", chunkSizes[i], compositeBlobInfo.getChunkSize());
      Assert.assertEquals("Total size doesn't match", totalSizes[i], compositeBlobInfo.getTotalSize());
      Assert.assertEquals("List of keys dont match", keys, compositeBlobInfo.getKeys());

      testBlobCorruption(blob, blobSize, metadataContentSize);
    }
  }
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