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

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

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

ListAssert.startsWith介绍

暂无

代码示例

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

@Test
public void testMapper() {
  h.execute("insert into something (id, name) values (1, 'eric')");
  h.execute("insert into something (id, name) values (2, 'brian')");
  ResultIterable<String> query = h.createQuery("select name from something order by id").map((r, ctx) -> r.getString(1));
  List<String> r = query.list();
  assertThat(r).startsWith("eric");
}

代码示例来源:origin: spring-cloud/spring-cloud-gateway

private void assertWeightCalculation(WeightCalculatorWebFilter filter, String group, int item,
                   int weight, List<Double> normalized, Double... middleRanges) {
  String routeId = route(item);
  filter.addWeightConfig(new WeightConfig(group, routeId, weight));
  Map<String, GroupWeightConfig> groupWeights = filter.getGroupWeights();
  assertThat(groupWeights).containsKey(group);
  GroupWeightConfig config = groupWeights.get(group);
  assertThat(config.group).isEqualTo(group);
  assertThat(config.weights).hasSize(item)
      .containsEntry(routeId, weight);
  assertThat(config.normalizedWeights).hasSize(item);
  for (int i = 0; i < normalized.size(); i++) {
    assertThat(config.normalizedWeights)
        .containsEntry(route(i+1), normalized.get(i));
  }
  for (int i = 0; i < normalized.size(); i++) {
    assertThat(config.rangeIndexes)
        .containsEntry(i, route(i+1));
  }
  assertThat(config.ranges).hasSize(item + 1)
      .startsWith(0.0)
      .endsWith(1.0);
  if (middleRanges.length > 0) {
    assertThat(config.ranges).contains(middleRanges);
  }
}

代码示例来源:origin: reactor/reactor-core

@Test
public void delayFirstInterval() {
  Supplier<Flux<Tuple2<Long, Long>>> test = () -> Flux.interval(Duration.ofMillis(50))
                          .delaySequence(Duration.ofMillis(500))
                          .elapsed()
                            .take(33);
  StepVerifier.withVirtualTime(test)
        .thenAwait(Duration.ofMillis(500 + 50))
        .recordWith(ArrayList::new)
        .assertNext(t2 -> assertThat(t2.getT1()).isEqualTo(550))
        .thenAwait(Duration.ofMillis(33 * 50))
        .thenConsumeWhile(t2 -> t2.getT1() == 50)
        .consumeRecordedWith(record -> {
          assertThat(record.stream().mapToLong(Tuple2::getT2))
               .startsWith(0L, 1L, 2L)
               .endsWith(30L, 31L, 32L)
               .isSorted()
               .hasSize(33);
        })
        .verifyComplete();
}

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

@Test
public void testMappedQueryObject() {
  h.execute("insert into something (id, name) values (1, 'eric')");
  h.execute("insert into something (id, name) values (2, 'brian')");
  ResultIterable<Something> query = h.createQuery("select * from something order by id").mapToBean(Something.class);
  List<Something> r = query.list();
  assertThat(r).startsWith(new Something(1, "eric"));
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void sortProductsByCategory2() {
  final Comparator<Product> comparator = comparatorOfStagedForCategory(category2Id);
  assertThat(productsSortedBy(comparator)).startsWith(id5, id2, id1);
}

代码示例来源:origin: jlink/jqwik

@Example
void creation(@ForAll long seed) {
  Shrinkable<Integer> integerShrinkable = new OneStepShrinkable(3);
  Function<Integer, Arbitrary<String>> flatMapper = anInt -> Arbitraries.strings().alpha().ofLength(anInt);
  Shrinkable<String> shrinkable = integerShrinkable.flatMap(flatMapper, 1000, seed);
  assertThat(shrinkable.distance().dimensions()).startsWith(ShrinkingDistance.of(3), ShrinkingDistance.of(3));
  assertThat(shrinkable.value()).hasSize(3);
}

相关文章

微信公众号

最新文章

更多

ListAssert类方法