@Test
  public void testBlobRecordV3() throws IOException, MessageFormatException {
    // Test the size method.
    int blobSize = 4096;
    int size = (int) MessageFormatRecord.Blob_Format_V3.getBlobRecordSize(blobSize);
    Assert.assertTrue(size > 0);

    // Generate source blob, serialize blob into BlobData.
    ByteBuffer entireBlob = ByteBuffer.allocate(size);
    ByteBuffer blobContent = ByteBuffer.allocate(blobSize);
    new Random().nextBytes(blobContent.array());
    MessageFormatRecord.Blob_Format_V3.serializePartialBlobRecord(entireBlob, blobSize, BlobType.DataBlob, true);
    entireBlob.put(blobContent);
    CRC32 crc = new CRC32();
    crc.update(entireBlob.array(), 0, entireBlob.position());
    entireBlob.putLong(crc.getValue());

    // De-serialize the blobData from the serialized content.
    entireBlob.flip();
    BlobData blobData = MessageFormatRecord.deserializeBlob(new ByteBufferInputStream(entireBlob));
    Assert.assertEquals("Blob size mismatch", blobSize, blobData.getSize());
    byte[] verify = new byte[blobSize];
    blobData.content().readBytes(verify);
    Assert.assertArrayEquals("BlobContent mismatch", blobContent.array(), verify);
    blobData.release();

    // corrupt blob record by modifying a byte, the CRC check should fail.
    entireBlob.put(entireBlob.position() - 9, (byte) (entireBlob.get(entireBlob.position() - 9) / 2 + 1));
    entireBlob.flip();
    Exception ex = TestUtils.getException(() -> MessageFormatRecord.deserializeBlob(new ByteBufferInputStream(entireBlob)));
    Assert.assertTrue(ex instanceof MessageFormatException);
  }
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