org.assertj.core.api.IterableAssert.containsAll()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.assertj.core.api.IterableAssert.containsAll()方法的一些代码示例,展示了IterableAssert.containsAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IterableAssert.containsAll()方法的具体详情如下:
包路径:org.assertj.core.api.IterableAssert
类名称:IterableAssert
方法名:containsAll

IterableAssert.containsAll介绍

暂无

代码示例

代码示例来源:origin: apache/geode

@Test
public void testExportLogsAndStats() throws Exception {
 connectIfNeeded();
 connector.executeAndAssertThat("export logs").statusIsSuccess();
 String zipPath = getZipPathFromCommandResult(connector.getGfshOutput());
 Set<String> actualZipEnries = getZipEntries(zipPath);
 Set<String> expectedFiles = Sets.newHashSet(
   "locator-0" + File.separator + "locator-0.log",
   "server-1" + File.separator + "server-1.log",
   "server-1" + File.separator + "statistics.gfs");
 assertThat(actualZipEnries).containsAll(expectedFiles);
 // remove pulse.log if present
 actualZipEnries =
   actualZipEnries.stream().filter(x -> !x.endsWith("pulse.log")).collect(toSet());
 assertThat(actualZipEnries).hasSize(3);
}

代码示例来源:origin: apache/geode

@Test
public void testExportLogsOnly() throws Exception {
 connectIfNeeded();
 connector.executeAndAssertThat("export logs --logs-only").statusIsSuccess();
 String zipPath = getZipPathFromCommandResult(connector.getGfshOutput());
 Set<String> actualZipEnries = getZipEntries(zipPath);
 Set<String> expectedFiles = Sets.newHashSet(
   "locator-0" + File.separator + "locator-0.log",
   "server-1" + File.separator + "server-1.log");
 assertThat(actualZipEnries).containsAll(expectedFiles);
 // remove pulse.log if present
 actualZipEnries =
   actualZipEnries.stream().filter(x -> !x.endsWith("pulse.log")).collect(toSet());
 assertThat(actualZipEnries).hasSize(2);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void getMetricKeys_includes_metrics_from_qgate() {
 Set<String> metricKeys = ImmutableSet.of("foo", "bar", "baz");
 Set<Condition> conditions = metricKeys.stream().map(key -> {
  Condition condition = mock(Condition.class);
  when(condition.getMetricKey()).thenReturn(key);
  return condition;
 }).collect(Collectors.toSet());
 QualityGate gate = mock(QualityGate.class);
 when(gate.getConditions()).thenReturn(conditions);
 assertThat(underTest.getMetricKeys(gate)).containsAll(metricKeys);
}

代码示例来源:origin: apache/geode

private void getHeapCriticalMembersFrom_returnsNonEmptySet(Set adviseCriticalMembers, Set argSet,
  Set expectedResult) {
 when(resourceAdvisor.adviseCriticalMembers()).thenReturn(adviseCriticalMembers);
 Set<DistributedMember> criticalMembers = heapMonitor.getHeapCriticalMembersFrom(argSet);
 assertThat(criticalMembers).containsAll(expectedResult);
}

代码示例来源:origin: cbeust/testng

private void runTest(ITestNGMethod testNGMethod, ParameterHolder.ParameterOrigin origin) {
 ParameterHandler.ParameterBag params = invokeParameterCreation(testNGMethod);
 assertThat(params.parameterHolder).isNotNull();
 assertThat(params.parameterHolder.origin).isEqualByComparingTo(origin);
 Iterator<Object[]> iterators = params.parameterHolder.parameters;
 assertThat(iterators).containsAll(Collections.singletonList(new Object[] {"bar"}));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void keepAuthorizedProjectIds_returns_any_public_project_for_group_AnyOne_without_any_permission_in_DB_and_permission_USER() {
 assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, null, UserRole.USER))
  .containsAll(randomPublicProjectIds);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void keepAuthorizedProjectIds_returns_any_public_project_for_group_AnyOne_without_any_permission_in_DB_and_permission_CODEVIEWER() {
 assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, null, UserRole.CODEVIEWER))
  .containsAll(randomPublicProjectIds);
}

代码示例来源:origin: spring-projects/spring-security

/**
 * This uses a naming convention for the ids of the appendix to ensure that the entire appendix is documented.
 * The naming convention for the ids is documented in {@link Element#getIds()}.
 * @return
 */
@Test
public void countReferencesWhenReviewingDocumentationThenEntireSchemaIsIncluded()
  throws IOException {
  Map<String, Element> elementsByElementName =
    this.xml.elementsByElementName(this.schemaDocumentLocation);
  List<String> documentIds =
    Files.lines(Paths.get(this.referenceLocation))
      .filter(line -> line.matches("\\[\\[(nsa-.*)\\]\\]"))
      .map(line -> line.substring(2, line.length() - 2))
      .collect(Collectors.toList());
  Set<String> expectedIds =
    elementsByElementName.values().stream()
      .flatMap(element -> element.getIds().stream())
      .collect(Collectors.toSet());
  documentIds.removeAll(this.ignoredIds);
  expectedIds.removeAll(this.ignoredIds);
  assertThat(documentIds).containsAll(expectedIds);
  assertThat(expectedIds).containsAll(documentIds);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void keepAuthorizedProjectIds_returns_any_public_project_for_user_without_any_permission_in_DB_and_permission_CODEVIEWER() {
 assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, user.getId(), UserRole.CODEVIEWER))
  .containsAll(randomPublicProjectIds);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void keepAuthorizedProjectIds_returns_any_public_project_for_user_without_any_permission_in_DB_and_permission_USER() {
 assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, user.getId(), UserRole.USER))
  .containsAll(randomPublicProjectIds);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void keepAuthorizedUsersForRoleAndProject_returns_any_users_for_public_project_without_any_permission_in_DB_and_permission_CODEVIEWER() {
 ComponentDto project = db.components().insertPublicProject(organization);
 assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, randomExistingUserIds, UserRole.CODEVIEWER, project.getId()))
  .containsAll(randomExistingUserIds);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void keepAuthorizedUsersForRoleAndProject_returns_any_users_for_public_project_without_any_permission_in_DB_and_permission_USER() {
 ComponentDto project = db.components().insertPublicProject(organization);
 assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, randomExistingUserIds, UserRole.USER, project.getId()))
  .containsAll(randomExistingUserIds);
}

代码示例来源:origin: hcoles/pitest

private void assertContains(final Collection<Class<?>> expected,
  final Collection<Class<?>> actual) {
 assertThat(actual).containsAll(expected);
}

代码示例来源:origin: palantir/atlasdb

private void assertThatMetricsArePresent(ImmutableSet<String> poolNames) {
  assertThat(taggedMetricRegistry.getMetrics().keySet()).containsAll(
      poolNames.stream().map(this::getPoolMetricName).collect(Collectors.toSet()));
}

代码示例来源:origin: spring-projects/spring-kafka

assertThat(this.topics)
    .as("topic(s):'" + diff + "' are not in embedded topic list")
    .containsAll(new HashSet<>(Arrays.asList(topics)));
final AtomicBoolean assigned = new AtomicBoolean();
consumer.subscribe(Arrays.asList(topics), new ConsumerRebalanceListener() {

代码示例来源:origin: hcoles/pitest

@Test
public void shouldReturnRequestedMutators() {
 assertThat(parseStrings("MATH", "INVERT_NEGS")).containsAll(
   Arrays.asList(MathMutator.MATH_MUTATOR,
     InvertNegsMutator.INVERT_NEGS_MUTATOR));
}

代码示例来源:origin: palantir/atlasdb

@Test
public void generatedInterfaceHasInterfaceMethods() {
  Set<String> generatedMethods = TestingUtils.extractMethods(AutoDelegate_GenericsTester.class);
  Set<String> originalMethods = TestingUtils.extractNonStaticMethods(GenericsTester.class);
  assertThat(generatedMethods).containsAll(originalMethods);
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldNotFilterNotStaticMutants() {
 final Collection<MutationDetails> unmarked = aMutationDetail()
   .build(2);
 assertThat(this.testee.intercept(unmarked, null)).containsAll(unmarked);
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldNotFilterMutationsInLineZeroOfAJavaClass() {
 final List<MutationDetails> mutations = MutationDetailsMother.aMutationDetail()
 .withFilename("Foo.java")
 .withLineNumber(0)
 .build(0);
 assertThat(this.testee.intercept(mutations, this.unused)).containsAll(mutations);
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldNotFilterMutationsOhterLinesOfAKotlinClass() {
 final List<MutationDetails> mutations = MutationDetailsMother.aMutationDetail()
 .withFilename("Foo.kt")
 .withLineNumber(1)
 .build(0);
 assertThat(this.testee.intercept(mutations, this.unused)).containsAll(mutations);
}

相关文章

微信公众号

最新文章

更多