@Test
    public void testHandleUpgrade() {
        Map<String, Object> namespace = new HashMap<>();
        namespace.put("metadata", "3.3-IV1");
        namespace.put("feature", Collections.singletonList("foo.bar=6"));
        namespace.put("dry_run", false);
        String upgradeOutput = ToolsTestUtils.captureStandardOut(() -> {
            Throwable t = assertThrows(TerseException.class, () -> FeatureCommand.handleUpgrade(new Namespace(namespace), buildAdminClient()));
            assertTrue(t.getMessage().contains("1 out of 2 operation(s) failed."));
        });
        assertEquals(format("foo.bar was upgraded to 6.%n" +
            "Could not upgrade metadata.version to 5. Can't upgrade to lower version."), upgradeOutput);
    }
Unit test of {@link FeatureCommand} tool.
tools/src/test/java/org/apache/kafka/tools/FeatureCommandTest.java