本文整理了Java中org.assertj.core.api.AbstractListAssert.doesNotContain()
方法的一些代码示例,展示了AbstractListAssert.doesNotContain()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractListAssert.doesNotContain()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractListAssert
类名称:AbstractListAssert
方法名:doesNotContain
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_hide_attributes_without_values() {
MemoryMXBean memoryBean = mock(MemoryMXBean.class, Mockito.RETURNS_DEEP_STUBS);
when(memoryBean.getHeapMemoryUsage().getCommitted()).thenReturn(-1L);
JvmStateSection underTest = new JvmStateSection(PROCESS_NAME);
ProtobufSystemInfo.Section section = underTest.toProtobuf(memoryBean);
assertThat(section.getAttributesList()).extracting("key").doesNotContain("Heap Committed (MB)");
}
}
代码示例来源:origin: SonarSource/sonarqube
private void verifyInStandaloneSQ(ComponentContainer container) {
Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
assertThat(adapters)
.hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2)
.extracting(ComponentAdapter::getComponentKey)
.contains(ChangeLogLevelStandaloneService.class, ChangeLogLevelAction.class)
.doesNotContain(ChangeLogLevelClusterService.class);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void delete_by_uuids() {
OrganizationDto organization = db.organizations().insert();
QGateWithOrgDto qualityGate1 = qualityGateDbTester.insertQualityGate(organization);
QGateWithOrgDto qualityGate2 = qualityGateDbTester.insertQualityGate(organization);
underTest.deleteByUuids(dbSession, asList(qualityGate1.getUuid(), qualityGate2.getUuid()));
dbSession.commit();
assertThat(underTest.selectAll(dbSession, organization).stream())
.extracting(QualityGateDto::getUuid)
.doesNotContain(qualityGate1.getUuid(), qualityGate2.getUuid());
}
代码示例来源:origin: json-path/JsonPath
@Test
public void cached_path_with_predicates() {
Filter feq = Filter.filter(Criteria.where("category").eq("reference"));
Filter fne = Filter.filter(Criteria.where("category").ne("reference"));
DocumentContext JsonDoc = JsonPath.parse(JSON_DOCUMENT);
List<String> eq = JsonDoc.read("$.store.book[?].category", feq);
List<String> ne = JsonDoc.read("$.store.book[?].category", fne);
Assertions.assertThat(eq).contains("reference");
Assertions.assertThat(ne).doesNotContain("reference");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void commitAndIndex_single_user() {
UserDto user = db.users().insertUser();
UserDto anotherUser = db.users().insertUser();
underTest.commitAndIndex(db.getSession(), user);
List<UserDoc> docs = es.getDocuments(UserIndexDefinition.INDEX_TYPE_USER, UserDoc.class);
assertThat(docs)
.extracting(UserDoc::uuid)
.containsExactlyInAnyOrder(user.getUuid())
.doesNotContain(anotherUser.getUuid());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void select_projects_by_organization_does_not_return_branches() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
ComponentDto branch = db.components().insertProjectBranch(project);
assertThat(underTest.selectProjectsByOrganization(dbSession, organization.getUuid()))
.extracting(ComponentDto::uuid)
.containsExactlyInAnyOrder(project.uuid())
.doesNotContain(branch.uuid());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void filter_organization_user_is_member_of() {
UserDto user = db.users().insertUser();
userSession.logIn(user);
OrganizationDto organization = db.organizations().insert();
OrganizationDto organizationWithoutMember = db.organizations().insert();
db.organizations().addMember(organization, user);
SearchWsResponse result = call(ws.newRequest().setParam(PARAM_MEMBER, String.valueOf(true)));
assertThat(result.getOrganizationsList()).extracting(Organization::getKey)
.containsExactlyInAnyOrder(organization.getKey())
.doesNotContain(organizationWithoutMember.getKey());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void selectByQuery_on_component_uuids() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto sonarqube = db.components().insertComponent(newPrivateProjectDto(organizationDto));
ComponentDto jdk8 = db.components().insertComponent(newPrivateProjectDto(organizationDto));
ComponentDto cLang = db.components().insertComponent(newPrivateProjectDto(organizationDto));
ComponentQuery query = ComponentQuery.builder().setQualifiers(PROJECT)
.setComponentUuids(newHashSet(sonarqube.uuid(), jdk8.uuid())).build();
List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10);
assertThat(result).hasSize(2).extracting(ComponentDto::uuid)
.containsOnlyOnce(sonarqube.uuid(), jdk8.uuid())
.doesNotContain(cLang.uuid());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void filter_by_qualifier() {
OrganizationDto organizationDto = db.organizations().insert();
db.components().insertComponent(newView(organizationDto, "view-uuid"));
db.components().insertComponent(newPrivateProjectDto(organizationDto, "project-uuid"));
Permissions.SearchProjectPermissionsWsResponse result = newRequest()
.setParam(PARAM_QUALIFIER, Qualifiers.PROJECT)
.executeProtobuf(Permissions.SearchProjectPermissionsWsResponse.class);
assertThat(result.getProjectsList())
.extracting("id")
.contains("project-uuid")
.doesNotContain("view-uuid");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void search_by_component_keys() {
userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
ComponentDto jdk = db.components().insertPrivateProject();
ComponentDto sonarqube = db.components().insertPrivateProject();
ComponentDto sonarlint = db.components().insertPrivateProject();
SearchWsResponse result = call(SearchRequest.builder()
.setProjects(Arrays.asList(jdk.getKey(), sonarqube.getKey()))
.build());
assertThat(result.getComponentsList()).extracting(Component::getKey)
.containsExactlyInAnyOrder(jdk.getKey(), sonarqube.getKey())
.doesNotContain(sonarlint.getKey());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void search_by_component_uuids() {
userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
ComponentDto jdk = db.components().insertPrivateProject();
ComponentDto sonarqube = db.components().insertPrivateProject();
ComponentDto sonarlint = db.components().insertPrivateProject();
SearchWsResponse result = call(SearchRequest.builder()
.setProjectIds(Arrays.asList(jdk.uuid(), sonarqube.uuid()))
.build());
assertThat(result.getComponentsList()).extracting(Component::getKey)
.containsExactlyInAnyOrder(jdk.getKey(), sonarqube.getKey())
.doesNotContain(sonarlint.getKey());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void findAll_by_keys() {
db.getDbClient().metricDao().insert(db.getSession(), newMetricDto().setKey("ncloc"));
db.getDbClient().metricDao().insert(db.getSession(), newMetricDto().setKey("foo"));
db.getDbClient().metricDao().insert(db.getSession(), newMetricDto().setKey("coverage"));
db.commit();
assertThat(underTest.findAll(Arrays.asList("ncloc", "foo"))).extracting(Metric::getKey).containsExactlyInAnyOrder("ncloc", "foo")
.doesNotContain("coverage");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void provisioned_projects() {
userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
ComponentDto provisionedProject = db.components().insertPrivateProject();
ComponentDto analyzedProject = db.components().insertPrivateProject();
db.components().insertSnapshot(newAnalysis(analyzedProject));
SearchWsResponse response = call(SearchRequest.builder().setOnProvisionedOnly(true).build());
assertThat(response.getComponentsList()).extracting(Component::getKey)
.containsExactlyInAnyOrder(provisionedProject.getKey())
.doesNotContain(analyzedProject.getKey());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void ignore_profiles_on_unknown_language() {
QProfileDto profile1OnXoo1 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
QProfileDto profile2OnXoo1 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO2.getKey()));
QProfileDto profileOnUnknownLanguage = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage("unknown"));
SearchWsResponse result = call(ws.newRequest());
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
.containsExactlyInAnyOrder(profile1OnXoo1.getKee(), profile2OnXoo1.getKee())
.doesNotContain(profileOnUnknownLanguage.getKee());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void default_organization() {
OrganizationDto defaultOrganization = db.getDefaultOrganization();
OrganizationDto anotherOrganization = db.organizations().insert();
QProfileDto profile1OnDefaultOrg = db.qualityProfiles().insert(defaultOrganization, p -> p.setLanguage(XOO1.getKey()));
QProfileDto profile2OnDefaultOrg = db.qualityProfiles().insert(defaultOrganization, p -> p.setLanguage(XOO2.getKey()));
QProfileDto profileOnAnotherOrg = db.qualityProfiles().insert(anotherOrganization, p -> p.setLanguage(XOO1.getKey()));
SearchWsResponse result = call(ws.newRequest());
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
.containsExactlyInAnyOrder(profile1OnDefaultOrg.getKee(), profile2OnDefaultOrg.getKee())
.doesNotContain(profileOnAnotherOrg.getKee());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void specific_organization() {
OrganizationDto defaultOrganization = db.getDefaultOrganization();
OrganizationDto specificOrganization = db.organizations().insert();
QProfileDto profile1OnSpecificOrg = db.qualityProfiles().insert(specificOrganization, p -> p.setLanguage(XOO1.getKey()));
QProfileDto profile2OnSpecificOrg = db.qualityProfiles().insert(specificOrganization, p -> p.setLanguage(XOO2.getKey()));
QProfileDto profileOnDefaultOrg = db.qualityProfiles().insert(defaultOrganization, p -> p.setLanguage(XOO1.getKey()));
SearchWsResponse result = call(ws.newRequest().setParam(PARAM_ORGANIZATION, specificOrganization.getKey()));
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
.containsExactlyInAnyOrder(profile1OnSpecificOrg.getKee(), profile2OnSpecificOrg.getKee())
.doesNotContain(profileOnDefaultOrg.getKee());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void filter_on_language() {
QProfileDto profile1OnXoo1 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
QProfileDto profile2OnXoo1 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
QProfileDto profileOnXoo2 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO2.getKey()));
SearchWsResponse result = call(ws.newRequest().setParam(PARAM_LANGUAGE, XOO1.getKey()));
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
.containsExactlyInAnyOrder(profile1OnXoo1.getKee(), profile2OnXoo1.getKee())
.doesNotContain(profileOnXoo2.getKee());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void filter_on_default_profile() {
QProfileDto defaultProfile1 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
QProfileDto defaultProfile2 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO2.getKey()));
QProfileDto nonDefaultProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
db.qualityProfiles().setAsDefault(defaultProfile1, defaultProfile2);
SearchWsResponse result = call(ws.newRequest().setParam(PARAM_DEFAULTS, "true"));
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
.containsExactlyInAnyOrder(defaultProfile1.getKee(), defaultProfile2.getKee())
.doesNotContain(nonDefaultProfile.getKee());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void filter_on_defaults_and_name() {
QProfileDto sonarWayOnXoo1 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto sonarWayOnXoo2 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Sonar way").setLanguage(XOO2.getKey()));
QProfileDto anotherProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Another").setLanguage(XOO2.getKey()));
db.qualityProfiles().setAsDefault(sonarWayOnXoo1, anotherProfile);
SearchWsResponse result = call(ws.newRequest()
.setParam(PARAM_DEFAULTS, "true")
.setParam(PARAM_QUALITY_PROFILE, "Sonar way"));
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
.containsExactlyInAnyOrder(sonarWayOnXoo1.getKee())
.doesNotContain(sonarWayOnXoo2.getKee(), anotherProfile.getKee());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void filter_on_profile_name() {
QProfileDto sonarWayOnXoo1 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto sonarWayOnXoo2 = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto sonarWayInCamelCase = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Sonar Way").setLanguage(XOO2.getKey()));
QProfileDto anotherProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setName("Another").setLanguage(XOO2.getKey()));
SearchWsResponse result = call(ws.newRequest().setParam(PARAM_QUALITY_PROFILE, "Sonar way"));
assertThat(result.getProfilesList()).extracting(QualityProfile::getKey)
.containsExactlyInAnyOrder(sonarWayOnXoo1.getKee(), sonarWayOnXoo2.getKee())
.doesNotContain(anotherProfile.getKee(), sonarWayInCamelCase.getKee());
}
内容来源于网络,如有侵权,请联系作者删除!