@Test
    public void testHandleDowngradeDryRun() {
        Map<String, Object> namespace = new HashMap<>();
        namespace.put("metadata", "3.3-IV3");
        namespace.put("feature", Collections.singletonList("foo.bar=1"));
        namespace.put("dry_run", true);
        String downgradeOutput = ToolsTestUtils.captureStandardOut(() -> {
            Throwable t = assertThrows(TerseException.class, () -> FeatureCommand.handleDowngrade(new Namespace(namespace), buildAdminClient()));
            assertTrue(t.getMessage().contains("1 out of 2 operation(s) failed."));
        });
        assertEquals(format("foo.bar can be downgraded to 1.%n" +
            "Can not downgrade metadata.version to 7. Can't downgrade to newer version."), downgradeOutput);
    }
Unit test of {@link FeatureCommand} tool.
tools/src/test/java/org/apache/kafka/tools/FeatureCommandTest.java