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

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

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

AbstractListAssert.isEmpty介绍

暂无

代码示例

代码示例来源:origin: json-path/JsonPath

@Test
public void issue_predicate_brackets_must_change_priorities() {
  String json = "{\n"
      + "    \"logs\": [\n"
      + "        {\n"
      + "            \"id\": 2\n"
      + "        }\n"
      + "    ]\n"
      + "}";
  List<String> result = JsonPath.read(json, "$.logs[?(@.message && (@.id == 1 || @.id == 2))].id");
  assertThat(result).isEmpty();
  result = JsonPath.read(json, "$.logs[?((@.id == 2 || @.id == 1) && @.message)].id");
  assertThat(result).isEmpty();
}

代码示例来源:origin: json-path/JsonPath

@Test
public void path2() {
  List<Object> result = JsonPath.read("{\"a\":[{\"b\":1,\"c\":2},{\"b\":5,\"c\":2}]}", "a[?(@.b==4)].c");
  Assertions.assertThat(result).isEmpty();
}

代码示例来源:origin: json-path/JsonPath

@Test
public void issue_114_c() {
  String json = "{ \"p\": [\"valp\", \"valq\", \"valr\"] }";
  List<String> result = read(json, "$.p[?(@[0] == 'valp')]");
  assertThat(result).isEmpty();
}

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

private void assertThatLogsDoNotContain(LoggerLevel loggerLevel, String message) {
 assertThat(logTester.logs(loggerLevel)).filteredOn(m -> m.contains(message)).isEmpty();
}

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

private void assertThatNoLogsFromRecovery(LoggerLevel loggerLevel) {
 assertThat(logTester.logs(loggerLevel)).filteredOn(m -> m.contains("Elasticsearch recovery - ")).isEmpty();
}

代码示例来源:origin: json-path/JsonPath

@Test
public void no_path_ref_in_filter_hit_none() {
  List<String> res = JsonPath.parse(JSON_DOCUMENT).read("$.store.book[?('a' == 'b')].author");
  assertThat(res).isEmpty();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testOptionAndRequiredOption() throws Exception {
 String[] args = new String[]{"-a", "-b", "file"};
 TypedOption<String> b = new TypedOption<String>().setShortName("b").setLongName("bfile").setSingleValued(true)
   .setDescription("set the value of [b]").setType(String.class).setRequired(true);
 cli.removeOption("b").addOption(b);
 CommandLine evaluated = cli.parse(Arrays.asList(args));
 assertThat(getBooleanOption(evaluated, "a")).isTrue();
 assertThat(getStringOption(evaluated, "b")).isEqualTo("file");
 assertThat(evaluated.allArguments()).isEmpty();
}

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

@Test
public void applyExclusionsOnCoverageMeasures() throws IOException {
 File xooFile = new File(srcDir, "sample.xoo");
 FileUtils.write(xooFile, "Sample xoo\n\ncontent", StandardCharsets.UTF_8);
 File measures = new File(srcDir, "sample.xoo.measures");
 FileUtils.write(measures, "lines_to_cover:2", StandardCharsets.UTF_8);
 AnalysisResult result = tester.newAnalysis()
  .properties(ImmutableMap.<String, String>builder()
   .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
   .put("sonar.projectKey", "com.foo.project")
   .put("sonar.sources", "src")
   .build())
  .execute();
 Map<String, List<Measure>> allMeasures = result.allMeasures();
 assertThat(allMeasures.get("com.foo.project:src/sample.xoo")).extracting("metricKey", "intValue.value")
  .containsOnly(tuple("lines_to_cover", 2));
 result = tester.newAnalysis()
  .properties(ImmutableMap.<String, String>builder()
   .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
   .put("sonar.projectKey", "com.foo.project")
   .put("sonar.sources", "src")
   .put("sonar.coverage.exclusions", "src/sample.xoo")
   .build())
  .execute();
 allMeasures = result.allMeasures();
 assertThat(allMeasures.get("com.foo.project:src/sample.xoo")).extracting("metricKey", "intValue.value")
  .isEmpty();
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testWithRequiredOption() throws Exception {
 String[] args = new String[]{"-b", "file"};
 TypedOption<String> b = new TypedOption<String>().setShortName("b").setLongName("bfile").setSingleValued(true)
   .setDescription("set the value of [b]").setType(String.class).setRequired(true);
 cli.removeOption("b").addOption(b);
 CommandLine evaluated = cli.parse(Arrays.asList(args));
 assertThat(getBooleanOption(evaluated, "a")).isFalse();
 assertThat((String) evaluated.getOptionValue("b")).isEqualTo("file");
 assertThat(evaluated.allArguments()).isEmpty();
}

代码示例来源:origin: json-path/JsonPath

@Test
public void patterns_can_be_evaluated_with_ignore_case() {
  List<String> resLeft = JsonPath.parse(JSON_DOCUMENT).read("$.store.book[?(@.category =~ /REFERENCE/)].author");
  assertThat(resLeft).isEmpty();
  resLeft = JsonPath.parse(JSON_DOCUMENT).read("$.store.book[?(@.category =~ /REFERENCE/i)].author");
  assertThat(resLeft).containsExactly("Nigel Rees");
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testNegativeNumbers() throws CLIException {
 CLI cli = new DefaultCLI().setName("test");
 Option[] options = new Option[]{
   new TypedOption<Double>().setLongName("num").setSingleValued(true)
     .setType(Double.class)
 };
 cli.addOptions(Arrays.asList(options));
 CommandLine evaluated = cli.parse(Arrays.asList("--num", "-1.5"));
 assertThat(evaluated.cli().getOptions()).hasSize(1);
 assertThat(cli.getArguments()).isEmpty();
 assertThat((double) evaluated.getOptionValue("num")).isEqualTo(-1.5d);
 evaluated = cli.parse(Collections.singletonList("--num=-1.5"));
 assertThat(evaluated.cli().getOptions()).hasSize(1);
 assertThat(cli.getArguments()).isEmpty();
 assertThat((double) evaluated.getOptionValue("num")).isEqualTo(-1.5d);
}

代码示例来源:origin: json-path/JsonPath

@Test
public void a_path_can_be_deleted() {
  Object o = parse(JSON_DOCUMENT).delete("$.store.book[*].display-price").json();
  List<Integer> result = parse(o).read("$.store.book[*].display-price");
  assertThat(result).isEmpty();
}

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

@Test
public void suggestions_without_query_should_not_contain_favorites_without_permission() {
 ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organization));
 doReturn(singletonList(project)).when(favoriteFinder).list();
 componentIndexer.indexOnStartup(null);
 SuggestionsWsResponse response = ws.newRequest()
  .setMethod("POST")
  .executeProtobuf(SuggestionsWsResponse.class);
 assertThat(response.getResultsList())
  .flatExtracting(Category::getItemsList)
  .isEmpty();
}

代码示例来源:origin: hidroh/materialistic

@Test
public void testCreateWithoutQuery() {
  controller.create().start().resume(); // skip menu inflation
  assertThat(ShadowSearchRecentSuggestions.recentQueries).isEmpty();
  assertEquals(activity.getString(R.string.title_activity_search),
      activity.getDefaultTitle());
  assertNull(activity.getSupportActionBar().getSubtitle());
}

代码示例来源:origin: hidroh/materialistic

.getSystemService(Context.NOTIFICATION_SERVICE));
ShadowNotification shadowNotification = shadowOf(notificationManager.getNotification(1));
assertThat(shadowNotification.getProgress()).isEqualTo(3); // self + kid 1 + readability
assertThat(shadowNotification.getMax()).isEqualTo(104); // self + 2 kids + readability + web
assertThat(notificationManager.getAllNotifications()).isEmpty();

代码示例来源:origin: json-path/JsonPath

@Test
public void when_deep_scanning_non_array_subscription_is_ignored() {
  Object result = JsonPath.parse("{\"x\": [0,1,[0,1,2,3,null],null]}").read("$..[2][3]");
  assertThat(result).asList().containsOnly(3);
  result = JsonPath.parse("{\"x\": [0,1,[0,1,2,3,null],null], \"y\": [0,1,2]}").read("$..[2][3]");
  assertThat(result).asList().containsOnly(3);
  result = JsonPath.parse("{\"x\": [0,1,[0,1,2],null], \"y\": [0,1,2]}").read("$..[2][3]");
  assertThat(result).asList().isEmpty();
}

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

assertThat(response.getResultsList())
 .flatExtracting(Category::getItemsList)
 .hasSize(expectedNumberOfResults);
 assertThat(response.getResultsList())
  .filteredOn(q -> q.getItemsCount() > 0)
  .isEmpty();
} else {
 assertThat(response.getResultsList())
  .filteredOn(c -> "TRK".equals(c.getQ()))
  .extracting(Category::getMore)

代码示例来源:origin: json-path/JsonPath

@Test
public void operations_can_chained() {
  Object o = parse(JSON_DOCUMENT)
      .delete("$.store.book[*].display-price")
      .set("$.store.book[*].category", "A")
      .json();
  List<Integer> prices = parse(o).read("$.store.book[*].display-price");
  List<String> categories = parse(o).read("$.store.book[*].category");
  assertThat(prices).isEmpty();
  assertThat(categories).containsExactly("A", "A", "A", "A");
}

代码示例来源:origin: json-path/JsonPath

@Test
public void when_deep_scanning_illegal_property_access_is_ignored() {
  Object result = JsonPath.parse("{\"x\": {\"foo\": {\"bar\": 4}}, \"y\": {\"foo\": 1}}").read("$..foo");
  assertThat(result).asList().hasSize(2);
  result = JsonPath.parse("{\"x\": {\"foo\": {\"bar\": 4}}, \"y\": {\"foo\": 1}}").read("$..foo.bar");
  assertThat(result).asList().containsOnly(4);
  result = JsonPath.parse("{\"x\": {\"foo\": {\"bar\": 4}}, \"y\": {\"foo\": 1}}").read("$..[*].foo.bar");
  assertThat(result).asList().containsOnly(4);
  result = JsonPath.parse("{\"x\": {\"foo\": {\"baz\": 4}}, \"y\": {\"foo\": 1}}").read("$..[*].foo.bar");
  assertThat(result).asList().isEmpty();
}

代码示例来源:origin: hidroh/materialistic

@Test
public void testBindService() throws RemoteException {
  // no chrome installed should not bind service
  delegate.bindCustomTabsService(activity);
  assertThat(ShadowApplication.getInstance().getBoundServiceConnections()).isEmpty();
  // bind service should create connection
  shadowOf(RuntimeEnvironment.application.getPackageManager()).addResolveInfoForIntent(
      new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")),
      ShadowResolveInfo.newResolveInfo("label", "com.android.chrome", "DefaultActivity"));
  shadowOf(RuntimeEnvironment.application.getPackageManager()).addResolveInfoForIntent(
      new Intent("android.support.customtabs.action.CustomTabsService")
          .setPackage("com.android.chrome"),
      ShadowResolveInfo.newResolveInfo("label", "com.android.chrome", "DefaultActivity"));
  delegate.bindCustomTabsService(activity);
  List<ServiceConnection> connections = ShadowApplication.getInstance()
      .getBoundServiceConnections();
  assertThat(connections).isNotEmpty();
  // on service connected should create session and warm up client
  verify(service).warmup(anyLong());
  assertNotNull(delegate.getSession());
  verify(service).newSession(any(ICustomTabsCallback.class));
  // may launch url should success
  when(service.mayLaunchUrl(any(), any(), any(), any())).thenReturn(true);
  assertTrue(delegate.mayLaunchUrl(Uri.parse("http://www.example.com"), null, null));
  // on service disconnected should clear session
  delegate.unbindCustomTabsService(activity);
  assertNull(delegate.getSession());
}

相关文章

微信公众号

最新文章

更多