byte[] appendToLog(long size) throws StoreException {
    byte[] bytes = TestUtils.getRandomBytes((int) size);
    if (size > CuratedLogIndexState.HARD_DELETE_START_OFFSET) {
      // ensure at least one byte is set to 1 for hard delete verification purposes
      int randomByte = (int) (CuratedLogIndexState.HARD_DELETE_START_OFFSET + TestUtils.RANDOM.nextInt(
          (int) (size - CuratedLogIndexState.HARD_DELETE_START_OFFSET
              - CuratedLogIndexState.HARD_DELETE_LAST_PART_SIZE)));
      bytes[randomByte] = 1;
    }
    ByteBuffer buffer = ByteBuffer.wrap(bytes);
    ReadableByteChannel channel = Channels.newChannel(new ByteBufferInputStream(buffer));
    log.appendFrom(channel, buffer.capacity());
    return bytes;
  }
Appends random data of size {@code size} to the {@link #log}.
@param size the size of data that needs to be appended.
@return the data that was appended.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/CuratedLogIndexState.java