static void createTopics(
        QuorumController controller,
        String prefix,
        int numTopics,
        int replicationFactor
    ) throws Exception {
        HashSet<String> describable = new HashSet<>();
        for (int i = 0; i < numTopics; i++) {
            describable.add(prefix + i);
        }
        CreateTopicsRequestData request = new CreateTopicsRequestData();
        for (int i = 0; i < numTopics; i++) {
            request.topics().add(
                new CreatableTopic().
                    setName(prefix + i).
                    setNumPartitions(1).
                    setReplicationFactor((short) replicationFactor));
        }
        CreateTopicsResponseData response =
            controller.createTopics(ANONYMOUS_CONTEXT, request, describable).get();
        for (int i = 0; i < numTopics; i++) {
            CreatableTopicResult result = response.topics().find(prefix + i);
            if (result.errorCode() != Errors.TOPIC_ALREADY_EXISTS.code()) {
                assertEquals((short) 0, result.errorCode());
            }
        }
    }
Create some topics directly on the controller.

@param controller            The active controller.
@param prefix                The prefix to use for topic names.
@param numTopics             The number of topics to create.
@param replicationFactor     The replication factor to use.
metadata/src/test/java/org/apache/kafka/controller/QuorumControllerIntegrationTestUtils.java