public static RegisterControllerRecord createTestControllerRegistration(
        int id,
        boolean zkMigrationReady
    ) {
        return new RegisterControllerRecord().
            setControllerId(id).
            setIncarnationId(new Uuid(3465346L, id)).
            setZkMigrationReady(zkMigrationReady).
            setEndPoints(new RegisterControllerRecord.ControllerEndpointCollection(
                Arrays.asList(
                    new RegisterControllerRecord.ControllerEndpoint().
                        setName("CONTROLLER").
                        setHost("localhost").
                        setPort(8000 + id).
                        setSecurityProtocol(SecurityProtocol.PLAINTEXT.id),
                    new RegisterControllerRecord.ControllerEndpoint().
                        setName("CONTROLLER_SSL").
                        setHost("localhost").
                        setPort(9000 + id).
                        setSecurityProtocol(SecurityProtocol.SSL.id)
                ).iterator()
            )).
            setFeatures(new RegisterControllerRecord.ControllerFeatureCollection(
                Collections.singletonList(
                    new RegisterControllerRecord.ControllerFeature().
                        setName(MetadataVersion.FEATURE_NAME).
                        setMinSupportedVersion(MetadataVersion.MINIMUM_KRAFT_VERSION.featureLevel()).
                        setMaxSupportedVersion(MetadataVersion.IBP_3_6_IV1.featureLevel())
                ).iterator()
            ));
    }
Create a batch reader for testing.

@param lastOffset the last offset of the given list of records
@param appendTimestamp the append timestamp for the batches created
@param records the records
@return a batch reader which will return the given records
metadata/src/test/java/org/apache/kafka/metadata/RecordTestUtils.java