private S3StreamsMetadataImage generateStreamImage(long streamId, Range<Long> streamObjectRange,
        Range<Long> streamSetObjectRange, int step) {
        long objectId = 0;

        List<RangeMetadata> ranges = new ArrayList<>();
        List<S3StreamObject> streamObjects = new ArrayList<>();

        // streamObject first
        int rangeIndex = 0;
        for (long i = streamObjectRange.lowerEndpoint(); i < streamObjectRange.upperEndpoint(); i += step) {
            ranges.add(new RangeMetadata(streamId, 0L, rangeIndex,
                i, i + step, BROKER0));

            streamObjects.add(new S3StreamObject(objectId, streamId, i, i + step));
            rangeIndex++;
            objectId++;
        }

        // streamSetObject second
        DeltaList<S3StreamSetObject> broker0Objects = new DeltaList<>();
        for (long i = streamSetObjectRange.lowerEndpoint(); i < streamSetObjectRange.upperEndpoint(); i += step) {
            ranges.add(new RangeMetadata(streamId, 0L, rangeIndex,
                i, i + step, BROKER0));
            rangeIndex++;
            broker0Objects.add(new S3StreamSetObject(objectId, BROKER0,
                List.of(new StreamOffsetRange(streamId, i, i + step)), i));
            objectId++;
        }

        NodeS3StreamSetObjectMetadataImage broker0WALMetadataImage =
            new NodeS3StreamSetObjectMetadataImage(BROKER0, S3StreamConstant.INVALID_BROKER_EPOCH,
                broker0Objects);

        S3StreamMetadataImage streamImage = new S3StreamMetadataImage(
            streamId, 4L, StreamState.OPENED, new S3StreamRecord.TagCollection(),
            streamObjectRange.lowerEndpoint(),
            ranges, new DeltaList<>(streamObjects));

        RegistryRef ref = new RegistryRef();
        TimelineHashMap<Long, S3StreamMetadataImage> streamMetadataMap = new TimelineHashMap<>(ref.registry(), 0);
        streamMetadataMap.put(streamId, streamImage);
        TimelineHashMap<Integer, NodeS3StreamSetObjectMetadataImage> nodeMetadataMap = new TimelineHashMap<>(ref.registry(), 0);
        nodeMetadataMap.put(BROKER0, broker0WALMetadataImage);
        ref = ref.next();
        return new S3StreamsMetadataImage(streamId, ref, streamMetadataMap,
            nodeMetadataMap, new TimelineHashMap<>(ref.registry(), 0), new TimelineHashMap<>(ref.registry(), 0),
            new TimelineHashMap<>(RegistryRef.NOOP.registry(), 0));
    }
Test get objects with the first hit object is a stream object.
metadata/src/test/java/org/apache/kafka/image/S3StreamsMetadataImageTest.java