public void verifyFetchedLogSegment(final RemoteLogSegmentId id, final int startPosition, final byte[] expected) {
            try {
                final InputStream in = remoteStorage.fetchLogSegment(newMetadata(id), startPosition);
                final ByteBuffer buffer = ByteBuffer.wrap(readFully(in));
                Iterator<Record> records = MemoryRecords.readableRecords(buffer).records().iterator();

                assertTrue(records.hasNext());
                assertEquals(ByteBuffer.wrap(expected), records.next().value());

            } catch (RemoteStorageException | IOException e) {
                throw new AssertionError(e);
            }
        }
Verifies the content of the remote segment matches with the {@code expected} array.

@param id The unique ID of the remote log segment and associated resources (e.g. offset and time indexes).
@param startPosition The position in the segment to fetch from.
@param expected The expected content.
storage/src/test/java/org/apache/kafka/server/log/remote/storage/LocalTieredStorageTest.java