本文整理了Java中org.assertj.core.api.IterableAssert.containsExactlyInAnyOrder()
方法的一些代码示例,展示了IterableAssert.containsExactlyInAnyOrder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IterableAssert.containsExactlyInAnyOrder()
方法的具体详情如下:
包路径:org.assertj.core.api.IterableAssert
类名称:IterableAssert
方法名:containsExactlyInAnyOrder
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void reload_list_if_plugin_uninstalled_during_blue_green_switch() throws IOException {
WsTestUtil.mockReader(wsClient, "api/plugins/installed",
new InputStreamReader(getClass().getResourceAsStream("ScannerPluginInstallerTest/blue-installed.json")),
new InputStreamReader(getClass().getResourceAsStream("ScannerPluginInstallerTest/green-installed.json")));
enqueueNotFoundDownload("scmgit", "abc");
enqueueDownload("java", "def");
enqueueDownload("cobol", "ghi");
when(pluginPredicate.apply(any())).thenReturn(true);
Map<String, ScannerPlugin> result = underTest.installRemotes();
assertThat(result.keySet()).containsExactlyInAnyOrder("java", "cobol");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void filter_blacklisted_plugins() throws IOException {
WsTestUtil.mockReader(wsClient, "api/plugins/installed", new InputStreamReader(getClass().getResourceAsStream("ScannerPluginInstallerTest/installed-plugins-ws.json")));
enqueueDownload("scmgit", "abc");
enqueueDownload("java", "def");
when(pluginPredicate.apply("scmgit")).thenReturn(true);
when(pluginPredicate.apply("java")).thenReturn(false);
Map<String, ScannerPlugin> result = underTest.installRemotes();
assertThat(result.keySet()).containsExactlyInAnyOrder("scmgit");
verify(pluginFiles, times(1)).get(any());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void commitAndIndexByProjectUuids_calls_indexer_with_only_its_supported_items() {
EsQueueDto item1a = EsQueueDto.create("fake/fake1", "P1");
EsQueueDto item1b = EsQueueDto.create("fake/fake1", "P1");
EsQueueDto item2 = EsQueueDto.create("fake/fake2", "P1");
FakeIndexer indexer1 = new FakeIndexer(asList(item1a, item1b));
FakeIndexer indexer2 = new FakeIndexer(singletonList(item2));
DbSession dbSession = mock(DbSession.class);
ProjectIndexersImpl underTest = new ProjectIndexersImpl(indexer1, indexer2);
underTest.commitAndIndexByProjectUuids(dbSession, singletonList("P1"), ProjectIndexer.Cause.PROJECT_CREATION);
assertThat(indexer1.calledItems).containsExactlyInAnyOrder(item1a, item1b);
assertThat(indexer2.calledItems).containsExactlyInAnyOrder(item2);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void define_xoo_hotspot_rule() {
RulesDefinition.Repository repo = context.repository("xoo");
assertThat(repo).isNotNull();
assertThat(repo.name()).isEqualTo("Xoo");
assertThat(repo.language()).isEqualTo("xoo");
assertThat(repo.rules()).hasSize(19);
RulesDefinition.Rule rule = repo.rule(HotspotSensor.RULE_KEY);
assertThat(rule.name()).isNotEmpty();
assertThat(rule.securityStandards())
.isNotEmpty()
.containsExactlyInAnyOrder("cwe:1", "cwe:123", "cwe:863", "owaspTop10:a1", "owaspTop10:a3");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void mark_rules_profiles_of_default_org_as_built_in() throws SQLException {
enableOrganization();
String defaultOrganizationUuid = "ORG_UUID_1";
setDefaultOrganization(defaultOrganizationUuid);
IntStream.rangeClosed(1, 3).forEach(i -> {
insertProfile(defaultOrganizationUuid, "RP_UUID_" + i, false);
insertProfile("ORG_UUID_404", "RP_UUID_404_" + i, false);
});
underTest.execute();
assertThat(selectRulesProfiles(true)).containsExactlyInAnyOrder("RP_UUID_1", "RP_UUID_2", "RP_UUID_3");
assertThat(selectRulesProfiles(false)).containsExactlyInAnyOrder("RP_UUID_404_1", "RP_UUID_404_2", "RP_UUID_404_3");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void do_nothing_if_org_disabled() throws SQLException {
String defaultOrganizationUuid = "ORG_UUID_1";
setDefaultOrganization(defaultOrganizationUuid);
IntStream.rangeClosed(1, 3).forEach(i -> {
insertProfile(defaultOrganizationUuid, "RP_UUID_" + i, false);
insertProfile("ORG_UUID_404", "RP_UUID_404_" + i, false);
});
underTest.execute();
assertThat(selectRulesProfiles(false)).containsExactlyInAnyOrder("RP_UUID_1", "RP_UUID_2", "RP_UUID_3", "RP_UUID_404_1", "RP_UUID_404_2", "RP_UUID_404_3");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getMetricsRelatedTo() {
Condition condition = new Condition("metric1", Condition.Operator.GREATER_THAN, "10");
QualityGate gate = new QualityGate("1", "foo", ImmutableSet.of(condition));
Set<String> result = underTest.getMetricsRelatedTo(gate);
assertThat(result).containsExactlyInAnyOrder(
// the metrics needed to compute the status of gate
condition.getMetricKey(),
// generated metrics
CoreMetrics.ALERT_STATUS_KEY, CoreMetrics.QUALITY_GATE_DETAILS_KEY);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void reentrant_migration() throws SQLException {
enableOrganization();
String defaultOrganizationUuid = "ORG_UUID_1";
setDefaultOrganization(defaultOrganizationUuid);
IntStream.rangeClosed(1, 3).forEach(i -> {
insertProfile(defaultOrganizationUuid, "RP_UUID_" + i, false);
insertProfile("ORG_UUID_404", "RP_UUID_404_" + i, false);
});
underTest.execute();
underTest.execute();
assertThat(selectRulesProfiles(true)).containsExactlyInAnyOrder("RP_UUID_1", "RP_UUID_2", "RP_UUID_3");
assertThat(selectRulesProfiles(false)).containsExactlyInAnyOrder("RP_UUID_404_1", "RP_UUID_404_2", "RP_UUID_404_3");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void definition() {
WebService.Action definition = ws.getDef();
assertThat(definition.key()).isEqualTo("set_setting");
assertThat(definition.isPost()).isTrue();
assertThat(definition.isInternal()).isTrue();
assertThat(definition.since()).isEqualTo("7.6");
assertThat(definition.params())
.extracting(WebService.Param::key, WebService.Param::isRequired, WebService.Param::maximumLength)
.containsOnly(
tuple("key", true, 100),
tuple("value", true, 4000));
assertThat(definition.param("key").possibleValues()).containsExactlyInAnyOrder("notifications.optOut", "notifications.readDate");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void verify_security_standards_indexation() {
RuleDefinitionDto rule = db.rules().insert(r -> r.setSecurityStandards(new HashSet<>(Arrays.asList("cwe:123", "owaspTop10:a3", "cwe:863"))));
ComponentDto project = db.components().insertPrivateProject(organization);
ComponentDto dir = db.components().insertComponent(ComponentTesting.newDirectory(project, "src/main/java/foo"));
ComponentDto file = db.components().insertComponent(newFileDto(project, dir, "F1"));
IssueDto issue = db.issues().insertIssue(IssueTesting.newIssue(rule, project, file));
underTest.indexOnStartup(emptySet());
IssueDoc doc = es.getDocuments(INDEX_TYPE_ISSUE, IssueDoc.class).get(0);
assertThat(doc.getCwe()).containsExactlyInAnyOrder("123", "863");
assertThat(doc.getOwaspTop10()).containsExactlyInAnyOrder("a3");
assertThat(doc.getSansTop25()).containsExactlyInAnyOrder(SANS_TOP_25_POROUS_DEFENSES);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_add_languages_per_module_and_globally() throws IOException {
InputComponentStoreTester tester = new InputComponentStoreTester();
String mod1Key = "mod1";
tester.addFile(mod1Key, "src/main/java/Foo.java", "java");
String mod2Key = "mod2";
tester.addFile(mod2Key, "src/main/groovy/Foo.groovy", "groovy");
assertThat(tester.languages(mod1Key)).containsExactly("java");
assertThat(tester.languages(mod2Key)).containsExactly("groovy");
assertThat(tester.languages()).containsExactlyInAnyOrder("java", "groovy");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_find_files_per_module_and_globally() throws IOException {
InputComponentStoreTester tester = new InputComponentStoreTester();
String mod1Key = "mod1";
InputFile mod1File = tester.addFile(mod1Key, "src/main/java/Foo.java", "java");
String mod2Key = "mod2";
InputFile mod2File = tester.addFile(mod2Key, "src/main/groovy/Foo.groovy", "groovy");
assertThat(tester.filesByModule(mod1Key)).containsExactly(mod1File);
assertThat(tester.filesByModule(mod2Key)).containsExactly(mod2File);
assertThat(tester.inputFiles()).containsExactlyInAnyOrder(mod1File, mod2File);
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void delete_files_and_directories() {
MapSettings settings = new MapSettings(new PropertyDefinitions(PurgeProperties.all()));
settings.setProperty(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES, 5);
Date now = new Date();
PurgeConfiguration underTest = PurgeConfiguration.newDefaultPurgeConfiguration(settings.asConfig(), new IdUuidPair(42L, "any-uuid"), emptyList());
assertThat(underTest.getScopesWithoutHistoricalData())
.containsExactlyInAnyOrder(Scopes.DIRECTORY, Scopes.FILE);
assertThat(underTest.maxLiveDateOfClosedIssues(now)).isEqualTo(DateUtils.addDays(now, -5));
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void set_and_get_headers() {
underTest.setHeader("foo", "fooz");
underTest.setHeader("bar", "barz");
assertThat(underTest.getHeaders().getNames()).containsExactlyInAnyOrder("foo", "bar");
assertThat(underTest.getHeaders().getValue("foo")).hasValue("fooz");
assertThat(underTest.getHeaders().getValue("bar")).hasValue("barz");
assertThat(underTest.getHeaders().getValue("xxx")).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void reentrant_of_crashed_migration() throws SQLException {
enableOrganization();
String defaultOrganizationUuid = "ORG_UUID_1";
setDefaultOrganization(defaultOrganizationUuid);
insertProfile(defaultOrganizationUuid, "RP_UUID_1", true);
insertProfile(defaultOrganizationUuid, "RP_UUID_2", false);
insertProfile(defaultOrganizationUuid, "RP_UUID_3", false);
underTest.execute();
assertThat(selectRulesProfiles(true)).containsExactlyInAnyOrder("RP_UUID_1", "RP_UUID_2", "RP_UUID_3");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_cache_files_by_filename() throws IOException {
ModuleInputComponentStore store = newModuleInputComponentStore();
String filename = "some name";
InputFile inputFile1 = new TestInputFileBuilder(projectKey, "some/path/" + filename).build();
store.doAdd(inputFile1);
InputFile inputFile2 = new TestInputFileBuilder(projectKey, "other/path/" + filename).build();
store.doAdd(inputFile2);
InputFile dummyInputFile = new TestInputFileBuilder(projectKey, "some/path/Dummy.java").build();
store.doAdd(dummyInputFile);
assertThat(store.getFilesByName(filename)).containsExactlyInAnyOrder(inputFile1, inputFile2);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_cache_files_by_extension() throws IOException {
ModuleInputComponentStore store = newModuleInputComponentStore();
InputFile inputFile1 = new TestInputFileBuilder(projectKey, "some/path/Program.java").build();
store.doAdd(inputFile1);
InputFile inputFile2 = new TestInputFileBuilder(projectKey, "other/path/Utils.java").build();
store.doAdd(inputFile2);
InputFile dummyInputFile = new TestInputFileBuilder(projectKey, "some/path/NotJava.cpp").build();
store.doAdd(dummyInputFile);
assertThat(store.getFilesByExtension("java")).containsExactlyInAnyOrder(inputFile1, inputFile2);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void selectUuidsOfOrganizationsWithoutDefaultProfile() {
OrganizationDto org1 = dbTester.organizations().insert();
OrganizationDto org2 = dbTester.organizations().insert();
QProfileDto profileInOrg1 = dbTester.qualityProfiles().insert(org1, p -> p.setLanguage("java"));
QProfileDto profileInOrg2 = dbTester.qualityProfiles().insert(org2, p -> p.setLanguage("java"));
dbTester.qualityProfiles().setAsDefault(profileInOrg1);
assertThat(underTest.selectUuidsOfOrganizationsWithoutDefaultProfile(dbSession, "java"))
.containsExactly(org2.getUuid());
assertThat(underTest.selectUuidsOfOrganizationsWithoutDefaultProfile(dbSession, "js"))
.containsExactlyInAnyOrder(org1.getUuid(), org2.getUuid());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void application_search_project_issues() {
ComponentDto project1 = db.components().insertPublicProject();
ComponentDto project2 = db.components().insertPublicProject();
ComponentDto application = db.components().insertApplication(db.getDefaultOrganization());
db.components().insertComponents(newProjectCopy("PC1", project1, application));
db.components().insertComponents(newProjectCopy("PC2", project2, application));
userSession.registerComponents(application, project1, project2);
IssueQuery result = underTest.create(new SearchRequest().setComponentUuids(singletonList(application.uuid())));
assertThat(result.viewUuids()).containsExactlyInAnyOrder(application.uuid());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void selectUuidsOfCustomRulesProfiles_returns_the_custom_profiles_with_specified_name() {
OrganizationDto org1 = db.organizations().insert();
OrganizationDto org2 = db.organizations().insert();
OrganizationDto org3 = db.organizations().insert();
QProfileDto outdatedProfile1 = db.qualityProfiles().insert(org1, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo"));
QProfileDto outdatedProfile2 = db.qualityProfiles().insert(org2, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo"));
QProfileDto builtInProfile = db.qualityProfiles().insert(org3, p -> p.setIsBuiltIn(true).setLanguage("java").setName("foo"));
QProfileDto differentLanguage = db.qualityProfiles().insert(org1, p -> p.setIsBuiltIn(false).setLanguage("cobol").setName("foo"));
QProfileDto differentName = db.qualityProfiles().insert(org1, p -> p.setIsBuiltIn(false).setLanguage("java").setName("bar"));
Collection<String> keys = underTest.selectUuidsOfCustomRulesProfiles(dbSession, "java", "foo");
assertThat(keys).containsExactlyInAnyOrder(outdatedProfile1.getRulesProfileUuid(), outdatedProfile2.getRulesProfileUuid());
}
内容来源于网络,如有侵权,请联系作者删除!