@Override
    public void pluginLoaded(GoPluginDescriptor descriptor) {
        loadTaskConfigIntoPreferenceStore(descriptor);
    }
@Test
    public void shouldSetConfigForTheTaskCorrespondingToGivenPluginId() throws Exception {
        final GoPluginDescriptor descriptor = mock(GoPluginDescriptor.class);
        String pluginId = "test-plugin-id";
        when(descriptor.id()).thenReturn(pluginId);
        final Task task = mock(Task.class);
        TaskConfig config = new TaskConfig();
        TaskView taskView = mock(TaskView.class);
        when(task.config()).thenReturn(config);
        when(task.view()).thenReturn(taskView);
        PluginManager pluginManager = mock(PluginManager.class);
        final TaskExtension taskExtension = mock(TaskExtension.class);
        when(taskExtension.canHandlePlugin(pluginId)).thenReturn(true);

        doAnswer(invocationOnMock -> {
            final Action<Task> action = (Action<Task>) invocationOnMock.getArguments()[1];
            action.execute(task, descriptor);
            return null;
        }).when(taskExtension).doOnTask(eq(pluginId), any(Action.class));

        PluggableTaskPreferenceLoader pluggableTaskPreferenceLoader = new PluggableTaskPreferenceLoader(pluginManager, taskExtension);
        pluggableTaskPreferenceLoader.pluginLoaded(descriptor);
        assertThat(PluggableTaskConfigStore.store().hasPreferenceFor(pluginId), is(true));
        assertThat(PluggableTaskConfigStore.store().preferenceFor(pluginId), is(new TaskPreference(task)));
        verify(pluginManager).addPluginChangeListener(pluggableTaskPreferenceLoader);
    }