Repository: apache/kafka
File: tools/src/test/java/org/apache/kafka/tools/ConnectPluginPathTest.java (Java)

Code before:
        assertScanResult(true, TestPlugins.TestPlugin.NON_MIGRATED_CONVERTER, res.serviceLoading);
        assertScanResult(false, TestPlugins.TestPlugin.BAD_PACKAGING_STATIC_INITIALIZER_THROWS_REST_EXTENSION, res.reflective);
        assertScanResult(false, TestPlugins.TestPlugin.BAD_PACKAGING_STATIC_INITIALIZER_THROWS_REST_EXTENSION, res.serviceLoading);

        Map<String, List<String[]>> table = assertListSuccess(runCommand(
                "list",
                "--plugin-location",
                locationA,
                "--plugin-location",
                locationB
        ));
        // Non-migrated plugins get new manifests
        assertNonMigratedPluginsStatus(table, true);
        // Because --keep-not-found is specified, the bad packaging plugins keep their manifests
        assertBadPackagingPluginsStatus(table, false);
    }

    @Test
    public void testListEmptyPluginPathArg() {
        CommandResult res = runCommand(
                "list",
                "--plugin-path",
                ""
        );
        assertNotEquals(0, res.returnCode);
        assertTrue("'--plugin-path' must not be empty.\n".equals(res.err));
    }

    @Test
    public void testListEmptyPluginPathElementArg() {
        CommandResult res = runCommand(
                "list",
                "--plugin-path",
                "location-a,,location-b"
        );
        assertNotEquals(0, res.returnCode);
        assertTrue("'--plugin-path' values must not be empty.\n".equals(res.err));
    }

    @Test
    public void testListEmptyPluginPathInWorkerConfig() {
        Path configPath = workspace.resolve("worker-empty.properties");
        try {
            Files.writeString(configPath, "plugin.path=", StandardCharsets.UTF_8);
        } catch (IOException e) {
            fail("Failed to create test worker config: " + e.getMessage());
        }

        CommandResult res = runCommand(
                "list",
                "--worker-config",

Review comment (suggestion):
Please use `assertEquals` to validate the error message.

Code after:
        assertScanResult(true, TestPlugins.TestPlugin.NON_MIGRATED_CONVERTER, res.serviceLoading);
        assertScanResult(false, TestPlugins.TestPlugin.BAD_PACKAGING_STATIC_INITIALIZER_THROWS_REST_EXTENSION, res.reflective);
        assertScanResult(false, TestPlugins.TestPlugin.BAD_PACKAGING_STATIC_INITIALIZER_THROWS_REST_EXTENSION, res.serviceLoading);

        Map<String, List<String[]>> table = assertListSuccess(runCommand(
                "list",
                "--plugin-location",
                locationA,
                "--plugin-location",
                locationB
        ));
        // Non-migrated plugins get new manifests
        assertNonMigratedPluginsStatus(table, true);
        // Because --keep-not-found is specified, the bad packaging plugins keep their manifests
        assertBadPackagingPluginsStatus(table, false);
    }

    @Test
    public void testListEmptyPluginPathArg() {
        CommandResult res = runCommand(
                "list",
                "--plugin-path",
                ""
        );
        assertNotEquals(0, res.returnCode);
        assertEquals("'--plugin-path' must not be empty.\n", res.err);
    }

    @Test
    public void testListEmptyPluginPathElementArg() {
        CommandResult res = runCommand(
                "list",
                "--plugin-path",
                "location-a,,location-b"
        );
        assertNotEquals(0, res.returnCode);
        assertEquals("'--plugin-path' values must not be empty.\n", res.err);
    }

    @Test
    public void testListEmptyPluginPathInWorkerConfig() {
        Path configPath = workspace.resolve("worker-empty.properties");
        try {
            Files.writeString(configPath, "plugin.path=", StandardCharsets.UTF_8);
        } catch (IOException e) {
            fail("Failed to create test worker config: " + e.getMessage());
        }

        CommandResult res = runCommand(
                "list",
                "--worker-config",