use of org.sonar.api.web.page.Page.Scope.COMPONENT in project sonarqube by SonarSource.
the class PageRepositoryTest method filter_by_navigation_and_qualifier.
@Test
public void filter_by_navigation_and_qualifier() {
PageDefinition plugin = context -> context.addPage(Page.builder("my_plugin/K1").setName("K1").build()).addPage(Page.builder("my_plugin/K2").setName("K2").setScope(COMPONENT).setComponentQualifiers(Qualifier.PROJECT).build()).addPage(Page.builder("my_plugin/K3").setName("K3").setScope(COMPONENT).setComponentQualifiers(Qualifier.MODULE).build()).addPage(Page.builder("my_plugin/K4").setName("K4").setScope(GLOBAL).build()).addPage(Page.builder("my_plugin/K5").setName("K5").setScope(COMPONENT).setComponentQualifiers(Qualifier.VIEW).build());
underTest = new PageRepository(pluginRepository, new PageDefinition[] { plugin });
underTest.start();
List<Page> result = underTest.getComponentPages(false, Qualifiers.PROJECT);
assertThat(result).extracting(Page::getKey).containsExactly("my_plugin/K2");
}
Aggregations