@Test
  public void shouldDeclareExtensionWhenAdding() {
    ComponentContainer container = new ComponentContainer();
    PluginInfo plugin = mock(PluginInfo.class);
    container.addExtension(plugin, ComponentWithProperty.class);

    PropertyDefinitions propertyDefinitions =
        container.getComponentByType(PropertyDefinitions.class);
    assertThat(propertyDefinitions.get("foo")).isNotNull();
    assertThat(container.getComponentByType(ComponentWithProperty.class)).isNotNull();
    assertThat(container.getComponentByKey(ComponentWithProperty.class)).isNotNull();
  }
  @Test
  public void display_plugin_name_when_failing_to_add_extension() {
    ComponentContainer container = new ComponentContainer();
    PluginInfo plugin = mock(PluginInfo.class);

    container.startComponents();

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage(
        "Unable to register extension org.sonar.core.platform.ComponentContainerTest$UnstartableComponent");

    container.addExtension(plugin, UnstartableComponent.class);
  }