### Question:
DefaultPluginPersistentState implements Serializable, PluginPersistentState { public boolean isEnabled(final Plugin plugin) { final Boolean bool = map.get(plugin.getKey()); return (bool == null) ? plugin.isEnabledByDefault() : bool.booleanValue(); } @Deprecated  DefaultPluginPersistentState(); @Deprecated  DefaultPluginPersistentState(final Map<String, Boolean> map);   DefaultPluginPersistentState(final Map<String, Boolean> map, final boolean ignore); @Deprecated  DefaultPluginPersistentState(final PluginPersistentState state); Map<String, Boolean> getMap(); boolean isEnabled(final Plugin plugin); boolean isEnabled(final ModuleDescriptor<?> pluginModule); Map<String, Boolean> getPluginStateMap(final Plugin plugin); PluginRestartState getPluginRestartState(final String pluginKey);  }### Answer:
@Test public void testSetEnabledModuleDescriptor() { PluginPersistentState state = new DefaultPluginPersistentState(); final ModuleDescriptor<?> module = createModule("mock.plugin.key", "module.key"); state = PluginPersistentState.Builder.create(state).setEnabled(module, true).toState(); assertTrue(state.isEnabled(module)); state = PluginPersistentState.Builder.create(state).setEnabled(module, false).toState(); assertFalse(state.isEnabled(module)); }
@Test public void testSetEnabledPlugin() { PluginPersistentState state = new DefaultPluginPersistentState(); final StaticPlugin plugin = createMockPlugin("mock.plugin.key", true); state = PluginPersistentState.Builder.create(state).setEnabled(plugin, true).toState(); assertTrue(state.isEnabled(plugin)); state = PluginPersistentState.Builder.create(state).setEnabled(plugin, false).toState(); assertFalse(state.isEnabled(plugin)); }