private ByteBuffer getDataInWriteSet(MessageWriteSet messageWriteSet, int size) throws StoreException {
    MockWrite write = new MockWrite(size);
    long sizeWritten = 0;
    while (sizeWritten < size) {
      sizeWritten += messageWriteSet.writeTo(write);
    }
    return write.getBuffer();
  }
Gets the data of size in the {@code messageWriteSet} into a {@link ByteBuffer}
@param messageWriteSet the {@link MessageWriteSet} to read from
@param size the size of data to read. If this size is greater than the amount of data in {@code messageWriteSet},
            then this function will loop infinitely
@return a {@link ByteBuffer} containing data of size {@code size} from {@code messageWriteSet}
@throws StoreException
ambry-server/src/test/java/com/github/ambry/server/AmbryServerRequestsTest.java