private byte[] appendRandomData(LogSegment segment, int size) throws StoreException {
    byte[] buf = TestUtils.getRandomBytes(size);
    segment.appendFrom(ByteBuffer.wrap(buf));
    return buf;
  }
Appends random data of size {@code size} to given {@code segment}.
@param segment the {@link LogSegment} to append data to.
@param size the size of the data that should be appended.
@return the data that was appended.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/LogSegmentTest.java