private void testBlobCorruption(ByteBuffer blob, long blobSize, int metadataContentSize) throws IOException {
    // test corruption cases
    blob.rewind();
    // case 1: corrupt blob record version
    byte savedByte = blob.get(1);
    blob.put(1, (byte) (savedByte + 100));
    try {
      MessageFormatRecord.deserializeBlob(new ByteBufferInputStream(blob));
      fail("Failed to detect corruption of Blob record version ");
    } catch (MessageFormatException e) {
      Assert.assertEquals("Error code mismatch", MessageFormatErrorCodes.UnknownFormatVersion, e.getErrorCode());
    }

    // case 2: corrupt blob type
    blob.rewind();
    //reset previously corrupt byte
    blob.put(1, savedByte);
    savedByte = blob.get(2);
    blob.put(2, (byte) (savedByte + 1));
    try {
      MessageFormatRecord.deserializeBlob(new ByteBufferInputStream(blob));
      fail("Failed to detect corruption of blob type");
    } catch (MessageFormatException e) {
      Assert.assertEquals("Error code mismatch", MessageFormatErrorCodes.DataCorrupt, e.getErrorCode());
    }

    //case 3: corrupt part of metadata content
    blob.rewind();
    //reset previously corrupt byte
    blob.put(2, savedByte);
    // corrupt part of metadata content
    savedByte = blob.get((int) blobSize - metadataContentSize + 10);
    blob.put((int) blobSize - metadataContentSize + 10, (byte) (savedByte + 1));
    try {
      MessageFormatRecord.deserializeBlob(new ByteBufferInputStream(blob));
      fail("Failed to detect corruption of metadata content");
    } catch (MessageFormatException e) {
      Assert.assertEquals("Error code mismatch", MessageFormatErrorCodes.DataCorrupt, e.getErrorCode());
    }
  }
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