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

x33g5p2x  于2022-01-23 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(129)

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

ListAssert.hasSameElementsAs介绍

暂无

代码示例

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

@Test
public void install_provides_new_Configuration_when_getBootConfiguration_is_called_and_there_is_none_in_container() {
 CoreExtension coreExtension1 = newCoreExtension();
 CoreExtension coreExtension2 = newCoreExtension();
 when(coreExtensionRepository.loadedCoreExtensions()).thenReturn(Stream.of(coreExtension1, coreExtension2));
 ComponentContainer container = new ComponentContainer();
 underTest.install(container, noExtensionFilter(), noAdditionalSideFilter());
 verify(coreExtension1).load(contextCaptor.capture());
 verify(coreExtension2).load(contextCaptor.capture());
 // verify each core extension gets its own configuration
 assertThat(contextCaptor.getAllValues())
  .hasSameElementsAs(ImmutableSet.copyOf(contextCaptor.getAllValues()));
}

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

@Test
public void testCloneIfContainsTestsWithNamesMatchingAny() {
 XmlSuite suite = createDummySuiteWithTestNamesAs("test1", "test2");
 TestNamesMatcher testNamesMatcher =
   new TestNamesMatcher(suite, Collections.singletonList("test2"));
 List<XmlTest> xmlTests = testNamesMatcher.getMatchedTests();
 assertThat(suite.getTests()).hasSameElementsAs(xmlTests);
}

代码示例来源:origin: jdbi/jdbi

public void testSomethingByIterator() {
  final SomethingByIterator s = handle.attach(SomethingByIterator.class);
  List<Something> results = s.get(Arrays.asList(
      new SomethingKey(1, "1"),
      new SomethingKey(2, "2"))
    .iterator());
  assertThat(results).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

public void testSomethingByIterator() {
  final SomethingByIterator s = handle.attach(SomethingByIterator.class);
  List<Something> results = s.get(Arrays.asList(
      new SomethingKey(1, "1"),
      new SomethingKey(2, "2"))
    .iterator());
  assertThat(results).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByIterableHandleDefaultWithIterable() {
  final SomethingByIterableHandleDefault s = handle.attach(SomethingByIterableHandleDefault.class);
  final List<Something> out = s.get(new Iterable<Integer>() {
    @Override
    public Iterator<Integer> iterator() {
      return Arrays.asList(1, 2).iterator();
    }
  });
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByVarargsHandleDefaultWithVarargs() {
  final SomethingByVarargsHandleDefault s = handle.attach(SomethingByVarargsHandleDefault.class);
  final List<Something> out = s.get(1, 2);
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByVarargsHandleDefaultWithVarargs() {
  final SomethingByVarargsHandleDefault s = handle.attach(SomethingByVarargsHandleDefault.class);
  final List<Something> out = s.get(1, 2);
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByArrayHandleVoidWithArray() {
  final SomethingByArrayHandleVoid s = handle.attach(SomethingByArrayHandleVoid.class);
  final List<Something> out = s.get(new int[]{1, 2});
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingWithExplicitAttributeName() {
  final SomethingWithExplicitAttributeName s = handle.attach(SomethingWithExplicitAttributeName.class);
  final List<Something> out = s.get(1, 2);
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByArrayHandleVoidWithArray() {
  final SomethingByArrayHandleVoid s = handle.attach(SomethingByArrayHandleVoid.class);
  final List<Something> out = s.get(new int[]{1, 2});
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByIterableWithIterable() {
  final SomethingByIterable s = handle.attach(SomethingByIterable.class);
  final List<Something> out = s.get(() -> Arrays.asList(new SomethingKey(1, "1"),
      new SomethingKey(2, "2"))
      .iterator());
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: resilience4j/resilience4j

@Test
public void shouldRegisterMetrics() {
  BulkheadRegistry bulkheadRegistry = BulkheadRegistry.ofDefaults();
  bulkheadRegistry.bulkhead("testName");
  BulkheadMetrics bulkheadMetrics = BulkheadMetrics.ofBulkheadRegistry(bulkheadRegistry);
  bulkheadMetrics.bindTo(meterRegistry);
  final List<String> metricNames = meterRegistry.getMeters()
      .stream()
      .map(Meter::getId)
      .map(Meter.Id::getName)
      .collect(Collectors.toList());
  final List<String> expectedMetrics = newArrayList(
      "resilience4j.bulkhead.testName.available_concurrent_calls");
  assertThat(metricNames).hasSameElementsAs(expectedMetrics);
}

代码示例来源:origin: resilience4j/resilience4j

@Test
public void shouldRegisterMetrics() {
  RateLimiterRegistry rateLimiterRegistry = RateLimiterRegistry.ofDefaults();
  rateLimiterRegistry.rateLimiter("testName");
  RateLimiterMetrics rateLimiterMetrics = RateLimiterMetrics.ofRateLimiterRegistry(rateLimiterRegistry);
  rateLimiterMetrics.bindTo(meterRegistry);
  final List<String> metricNames = meterRegistry.getMeters()
      .stream()
      .map(Meter::getId)
      .map(Meter.Id::getName)
      .collect(Collectors.toList());
  final List<String> expectedMetrics = newArrayList(
      "resilience4j.ratelimiter.testName.available_permissions",
      "resilience4j.ratelimiter.testName.number_of_waiting_threads");
  assertThat(metricNames).hasSameElementsAs(expectedMetrics);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByIterableWithIterable() {
  final SomethingByIterable s = handle.attach(SomethingByIterable.class);
  final List<Something> out = s.get(() -> Arrays.asList(new SomethingKey(1, "1"),
      new SomethingKey(2, "2"))
      .iterator());
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: line/armeria

@Test
public void testGetEndpointGroup() {
  await().untilAsserted(() -> assertThat(endpointGroup.endpoints()).hasSameElementsAs(sampleEndpoints));
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingWithExplicitAttributeName() {
  final SomethingWithExplicitAttributeName s = handle.attach(SomethingWithExplicitAttributeName.class);
  final List<Something> out = s.get(
      new SomethingKey(1, "1"),
      new SomethingKey(2, "2"));
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingWithExplicitAttributeName() {
  final SomethingWithExplicitAttributeName s = handle.attach(SomethingWithExplicitAttributeName.class);
  final List<Something> out = s.get(
      new SomethingKey(1, "1"),
      new SomethingKey(2, "2"));
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByVarargsWithVarargs() {
  final SomethingByVarargs s = handle.attach(SomethingByVarargs.class);
  final List<Something> out = s.get(
      new SomethingKey(1, "1"),
      new SomethingKey(2, "2"));
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByArrayWithNonEmptyArray() {
  final SomethingByVarargs s = handle.attach(SomethingByVarargs.class);
  final List<Something> out = s.get(
      new SomethingKey(1, "1"),
      new SomethingKey(2, "2"));
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

代码示例来源:origin: jdbi/jdbi

@Test
public void testSomethingByArrayWithNonEmptyArray() {
  final SomethingByVarargs s = handle.attach(SomethingByVarargs.class);
  final List<Something> out = s.get(
      new SomethingKey(1, "1"),
      new SomethingKey(2, "2"));
  assertThat(out).hasSameElementsAs(expectedSomethings);
}

相关文章

微信公众号

最新文章

更多

ListAssert类方法