public ExtensionInstaller install(ExtensionContainer container, ExtensionMatcher matcher) {
    // core components
    for (Object o : BatchComponents.all()) {
      doInstall(container, matcher, null, o);
    }

    // plugin extensions
    installExtensionsForPlugins(container, matcher, pluginRepository.getPluginInfos());

    return this;
  }
@Test
  public void should_filter_extensions_to_install() {
    when(pluginRepository.getPluginInfos()).thenReturn(Arrays.asList(new PluginInfo("foo")));
    when(pluginRepository.getPluginInstance("foo")).thenReturn(newPluginInstance(Foo.class, Bar.class));

    ListContainer container = new ListContainer();
    ExtensionInstaller installer = new ExtensionInstaller(mock(SonarRuntime.class), pluginRepository, settings.asConfig());
    installer.install(container, new FooMatcher());

    assertThat(container.getAddedObjects())
      .contains(Foo.class)
      .doesNotContain(Bar.class);
  }