@Override
    public SCMPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
        SCMPropertyConfiguration scmConfiguration = extension.getSCMConfiguration(descriptor.id());
        SCMView scmView = extension.getSCMView(descriptor.id());
        PluggableInstanceSettings pluginSettingsAndView = getPluginSettingsAndView(descriptor, extension);
        if (scmConfiguration == null) {
            throw new RuntimeException(format("Plugin[%s] returned null scm configuration", descriptor.id()));
        }

        if (scmView == null) {
            throw new RuntimeException(format("Plugin[%s] returned null scm view", descriptor.id()));
        }

        PluggableInstanceSettings scmSettings = new PluggableInstanceSettings(scmPluginConfigurations(scmConfiguration), new PluginView(scmView.template()));
        return new SCMPluginInfo(descriptor, scmView.displayValue(), scmSettings, pluginSettingsAndView);
    }
@Test
    public void shouldBuildPluginInfo() throws Exception {
        GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();

        SCMPluginInfo pluginInfo = new SCMPluginInfoBuilder(extension).pluginInfoFor(descriptor);

        List<PluginConfiguration> scmConfigurations = List.of(
                new PluginConfiguration("username", new MetadataWithPartOfIdentity(true, false, true)),
                new PluginConfiguration("password", new MetadataWithPartOfIdentity(true, true, false))
        );
        PluginView pluginView = new PluginView("some html");
        List<PluginConfiguration> pluginSettings = List.of(new PluginConfiguration("k1", new Metadata(true, false)));

        assertThat(pluginInfo.getDescriptor(), is(descriptor));
        assertThat(pluginInfo.getExtensionName(), is("scm"));
        assertThat(pluginInfo.getDisplayName(), is("some scm plugin"));
        assertThat(pluginInfo.getScmSettings(), is(new PluggableInstanceSettings(scmConfigurations, pluginView)));
        assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginSettings, new PluginView("settings view"))));

    }