@Test
    public void testParseDescribeClusterResponseWithUnexpectedEndpointType() {
        assertThrows(MismatchedEndpointTypeException.class,
            () -> KafkaAdminClient.parseDescribeClusterResponse(new DescribeClusterResponseData().
                    setEndpointType(EndpointType.BROKER.id())));
    }
A unit test for KafkaAdminClient.

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