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

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

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

AbstractListAssert.startsWith介绍

暂无

代码示例

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

@Test
public void keys_of_directory_and_files_includes_always_root_project() {
 ScannerReport.Component project = newBuilder()
  .setType(PROJECT)
  .setKey("project 1")
  .setRef(1)
  .addChildRef(11).addChildRef(21).addChildRef(31).build();
 scannerComponentProvider.add(newBuilder().setRef(11).setType(MODULE).setKey("module 1").addChildRef(12).addChildRef(22).addChildRef(32));
 scannerComponentProvider.add(newBuilder().setRef(12).setType(MODULE).setKey("module 2").addChildRef(13).addChildRef(23).addChildRef(33));
 scannerComponentProvider.add(newBuilder().setRef(13).setType(MODULE).setKey("module 3").addChildRef(24).addChildRef(34));
 scannerComponentProvider.add(newBuilder().setRef(21).setType(DIRECTORY).setProjectRelativePath("directory in project").addChildRef(35));
 scannerComponentProvider.add(newBuilder().setRef(22).setType(DIRECTORY).setProjectRelativePath("directory in module 1").addChildRef(36));
 scannerComponentProvider.add(newBuilder().setRef(23).setType(DIRECTORY).setProjectRelativePath("directory in module 2").addChildRef(37));
 scannerComponentProvider.add(newBuilder().setRef(24).setType(DIRECTORY).setProjectRelativePath("directory in module 3").addChildRef(38));
 scannerComponentProvider.add(newBuilder().setRef(31).setType(FILE).setProjectRelativePath("file in project").setLines(1));
 scannerComponentProvider.add(newBuilder().setRef(32).setType(FILE).setProjectRelativePath("file in module 1").setLines(1));
 scannerComponentProvider.add(newBuilder().setRef(33).setType(FILE).setProjectRelativePath("file in module 2").setLines(1));
 scannerComponentProvider.add(newBuilder().setRef(34).setType(FILE).setProjectRelativePath("file in module 3").setLines(1));
 scannerComponentProvider.add(newBuilder().setRef(35).setType(FILE).setProjectRelativePath("file in directory in project").setLines(1));
 scannerComponentProvider.add(newBuilder().setRef(36).setType(FILE).setProjectRelativePath("file in directory in module 1").setLines(1));
 scannerComponentProvider.add(newBuilder().setRef(37).setType(FILE).setProjectRelativePath("file in directory in module 2").setLines(1));
 scannerComponentProvider.add(newBuilder().setRef(38).setType(FILE).setProjectRelativePath("file in directory in module 3").setLines(1));
 Component root = call(project);
 Map<String, Component> componentsByKey = indexComponentByKey(root);
 assertThat(componentsByKey.values()).extracting("key").startsWith("public_project 1");
 assertThat(componentsByKey.values()).extracting("dbKey").startsWith("generated_project 1");
}

代码示例来源:origin: nurkiewicz/rxjava-workshop

@Test
public void shouldParseAllUrls() throws Exception {
  //given
  Flowable<URL> all = Urls.all("urls.txt");
  
  //when
  List<URL> list = all
      .toList()
      .blockingGet();
  
  //then
  assertThat(list).hasSize(996);
  assertThat(list).startsWith(
      new URL("http://www.google.com"),
      new URL("http://www.youtube.com"),
      new URL("http://www.facebook.com"));
  assertThat(list).endsWith(
      new URL("http://www.king.com"),
      new URL("http://www.virginmedia.com"));
}

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

@Test
public void sortProductProjectionsOnSearchByCategory2() {
  final Comparator<ProductProjection> comparator = comparingCategoryOrderHints(category2Id);
  assertWithQueryResult(result -> {
    assertThat(productProjectionsSortedBy(result.productProjections, comparator)).has(itemsInThisOrder(asList(id5, id2, id1)));
    assertThat(result.sortedFromSearchForCategory2).extracting("id").as("search").startsWith(id5, id2, id1);
  });
}

代码示例来源:origin: org.apache.james/james-server-jmap

@Test
public void sortFromLeafToRootShouldReturnOrderedMailbox() {
  //Given
  Mailbox inbox = Mailbox.builder().name("INBOX").id(INBOX_ID).build();
  Mailbox a = Mailbox.builder().name("A").id(A_ID).parentId(INBOX_ID).build();
  Mailbox b = Mailbox.builder().name("B").id(B_ID).parentId(INBOX_ID).build();
  Mailbox c = Mailbox.builder().name("C").id(C_ID).parentId(B_ID).build();
  Mailbox d = Mailbox.builder().name("D").id(D_ID).parentId(A_ID).build();
  Mailbox e = Mailbox.builder().name("E").id(E_ID).parentId(C_ID).build();
  ImmutableList<Mailbox> input = ImmutableList.of(b, c, d, a, inbox, e);
  //When
  List<Mailbox> result = sut.sortFromLeafToRoot(input);
  assertThat(result).extracting(Mailbox::getName).endsWith("INBOX").startsWith("E");
}

代码示例来源:origin: org.apache.james/james-server-jmap

@Test
public void sortFromRootToLeafShouldReturnOrderedMailbox() {
  // Given
  Mailbox inbox = Mailbox.builder().name("INBOX").id(INBOX_ID).build();
  Mailbox a = Mailbox.builder().name("A").id(A_ID).parentId(INBOX_ID).build();
  Mailbox b = Mailbox.builder().name("B").id(B_ID).parentId(INBOX_ID).build();
  Mailbox c = Mailbox.builder().name("C").id(C_ID).parentId(B_ID).build();
  Mailbox d = Mailbox.builder().name("D").id(D_ID).parentId(A_ID).build();
  Mailbox e = Mailbox.builder().name("E").id(E_ID).parentId(C_ID).build();
  ImmutableList<Mailbox> input = ImmutableList.of(b, c, d, a, inbox, e);
  // When
  List<Mailbox> result = sut.sortFromRootToLeaf(input);
  // Then
  assertThat(result).extracting(Mailbox::getName).endsWith("C", "D", "E").startsWith("INBOX");
}

相关文章

微信公众号

最新文章

更多