use of org.sonar.core.platform.ExtensionContainer in project sonarqube by SonarSource.
the class CoreExtensionsInstallerTest method install_installs_extensions_annotated_with_expected_annotation.
@Test
@UseDataProvider("allMethodsToAddExtension")
public void install_installs_extensions_annotated_with_expected_annotation(BiConsumer<CoreExtension.Context, Collection<Object>> extensionAdder) {
List<Object> extensions = ImmutableList.of(WestSideClass.class, EastSideClass.class, OtherSideClass.class, Latitude.class);
CoreExtension coreExtension = newCoreExtension(context -> extensionAdder.accept(context, extensions));
when(coreExtensionRepository.loadedCoreExtensions()).thenReturn(Stream.of(coreExtension));
ExtensionContainer container = mock(ExtensionContainer.class);
underTest.install(container, noExtensionFilter(), noAdditionalSideFilter());
verify(container).addExtension(coreExtension.getName(), WestSideClass.class);
verify(container).declareExtension(coreExtension.getName(), OtherSideClass.class);
verify(container).declareExtension(coreExtension.getName(), EastSideClass.class);
verify(container).addExtension(coreExtension.getName(), Latitude.class);
verifyNoMoreInteractions(container);
}
Aggregations