@Test
    public void testInvalidBroker() {
        Throwable e = assertThrows(AdminCommandFailedException.class, () -> LeaderElectionCommand.run(
            Duration.ofSeconds(1),
            "--bootstrap-server", "example.com:1234",
            "--election-type", "unclean",
            "--all-topic-partitions"
        ));
        assertInstanceOf(TimeoutException.class, e.getCause());
    }
For some error cases, we can save a little build time by avoiding the overhead for
cluster creation and cleanup because the command is expected to fail immediately.
tools/src/test/java/org/apache/kafka/tools/LeaderElectionCommandErrorTest.java