@Test
    public void testMissingElectionType() {
        String[] args = {
            "--bootstrap-server", "nohost:9092",
            "--topic", "some-topic",
            "--partition", "0"
        };
        assertEquals(1, LeaderElectionCommand.mainNoExit(args));
        String out = ToolsTestUtils.captureStandardErr(() -> LeaderElectionCommand.mainNoExit(args));
        assertTrue(out.startsWith("Missing required option(s)"));
        assertTrue(out.contains(" election-type"));
    }
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