@ParameterizedTest
    @ValueSource(booleans = {false, true})
    public void testParseSuccessfulDescribeClusterResponse(boolean includeController) {
        Cluster cluster = KafkaAdminClient.parseDescribeClusterResponse(new DescribeClusterResponseData().
            setControllerId(includeController ? 0 : -1).
            setEndpointType(EndpointType.CONTROLLER.id()).
            setClusterId("Ek8tjqq1QBWfnaoyHFZqDg").
            setBrokers(new DescribeClusterResponseData.DescribeClusterBrokerCollection(asList(
                new DescribeClusterBroker().
                    setBrokerId(0).
                    setHost("controller0.com").
                    setPort(9092),
                new DescribeClusterBroker().
                    setBrokerId(1).
                    setHost("controller1.com").
                    setPort(9092),
                new DescribeClusterBroker().
                    setBrokerId(2).
                    setHost("controller2.com").
                    setPort(9092)).iterator())));
        if (includeController) {
            assertNotNull(cluster.controller());
            assertEquals(0, cluster.controller().id());
        } else {
            assertNull(cluster.controller());
        }
        assertEquals("Ek8tjqq1QBWfnaoyHFZqDg", cluster.clusterResource().clusterId());
        assertEquals(new HashSet<>(asList(
            new Node(0, "controller0.com", 9092),
            new Node(1, "controller1.com", 9092),
            new Node(2, "controller2.com", 9092))), new HashSet<>(cluster.nodes()));
    }
A unit test for KafkaAdminClient.

See AdminClientIntegrationTest for an integration test.
clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java