@Override
    public void enablePlugin(String pluginId) {
        if (!isPluginDisabled(pluginId)) {
            // do nothing
            return;
        }

        if (Files.exists(getEnabledFilePath())) {
            enabledPlugins.add(pluginId);

            try {
                FileUtils.writeLines(enabledPlugins, getEnabledFilePath());
            } catch (IOException e) {
                throw new PluginRuntimeException(e);
            }
        } else {
            disabledPlugins.remove(pluginId);

            try {
                FileUtils.writeLines(disabledPlugins, getDisabledFilePath());
            } catch (IOException e) {
                throw new PluginRuntimeException(e);
            }
        }
    }
@Test
    public void testEnablePlugin() throws Exception {
        // scenario with "enabled.txt"
        createEnabledFile();

        DefaultPluginStatusProvider statusProvider = new DefaultPluginStatusProvider(pluginsPath);
        statusProvider.enablePlugin("plugin-2");

        assertFalse(statusProvider.isPluginDisabled("plugin-1"));
        assertFalse(statusProvider.isPluginDisabled("plugin-2"));
        assertTrue(statusProvider.isPluginDisabled("plugin-3"));

        List<String> enabledPlugins = FileUtils.readLines(statusProvider.getEnabledFilePath(), true);
        assertTrue(enabledPlugins.contains("plugin-2"));

        assertTrue(Files.notExists(statusProvider.getDisabledFilePath()));

        // scenario with "disabled.txt"
        Files.delete(statusProvider.getEnabledFilePath());
        assertTrue(Files.notExists(statusProvider.getEnabledFilePath()));

        createDisabledFile();

        statusProvider = new DefaultPluginStatusProvider(pluginsPath);
        statusProvider.enablePlugin("plugin-2");

        assertFalse(statusProvider.isPluginDisabled("plugin-1"));
        assertFalse(statusProvider.isPluginDisabled("plugin-2"));

        List<String> disabledPlugins = FileUtils.readLines(statusProvider.getDisabledFilePath(), true);
        assertFalse(disabledPlugins.contains("plugin-2"));
    }