DefaultPluginStatusProvider implements PluginStatusProvider { @Override public boolean isPluginDisabled(String pluginId) { if (disabledPlugins.contains(pluginId)) { return true; } return !enabledPlugins.isEmpty() && !enabledPlugins.contains(pluginId); } DefaultPluginStatusProvider(Path pluginsRoot); @Override boolean isPluginDisabled(String pluginId); @Override void disablePlugin(String pluginId); @Override void enablePlugin(String pluginId); Path getEnabledFilePath(); Path getDisabledFilePath(); static Path getEnabledFilePath(Path pluginsRoot); static Path getDisabledFilePath(Path pluginsRoot);  }
@Test public void testIsPluginDisabled() throws IOException { createEnabledFile(); createDisabledFile(); PluginStatusProvider statusProvider = new DefaultPluginStatusProvider(pluginsPath); assertFalse(statusProvider.isPluginDisabled("plugin-1")); assertTrue(statusProvider.isPluginDisabled("plugin-2")); assertTrue(statusProvider.isPluginDisabled("plugin-3")); }
@Test public void testIsPluginDisabledWithEnableEmpty() throws IOException { createDisabledFile(); PluginStatusProvider statusProvider = new DefaultPluginStatusProvider(pluginsPath); assertFalse(statusProvider.isPluginDisabled("plugin-1")); assertTrue(statusProvider.isPluginDisabled("plugin-2")); assertFalse(statusProvider.isPluginDisabled("plugin-3")); }