本文整理了Java中org.assertj.core.api.ListAssert.isEmpty()
方法的一些代码示例,展示了ListAssert.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.isEmpty()
方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:isEmpty
暂无
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldExitOnErrorFromExecute()
throws IOException, InterruptedException
{
String sql = "select * from hive.default.nations; select * from hive.default.nation;";
launchPrestoCliWithServerArgument("--execute", sql);
assertThat(trimLines(presto.readRemainingOutputLines())).isEmpty();
assertThatThrownBy(() -> presto.waitForWithTimeoutAndKill()).hasMessage("Child process exited with non-zero code: 1");
}
代码示例来源:origin: SonarSource/sonarqube
private void assertSingleGetCall() {
Assertions.assertThat(getCalls).hasSize(1);
Assertions.assertThat(postCalls).isEmpty();
Assertions.assertThat(rawCalls).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void selectPotentialPermissions_with_unknown_template_and_no_user() {
List<String> result = underTest.selectPotentialPermissionsByUserIdAndTemplateId(dbSession, null, 42L);
assertThat(result).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void return_public_project_with_only_AllowAnyone_true_when_no_permission_in_DB() {
List<IndexPermissions> dtos = underTest.selectByUuids(dbClient, dbSession, singletonList(publicProject.uuid()));
Assertions.assertThat(dtos).hasSize(1);
IndexPermissions dto = dtos.get(0);
assertThat(dto.getGroupIds()).isEmpty();
assertThat(dto.getUserIds()).isEmpty();
assertThat(dto.isAllowAnyone()).isTrue();
assertThat(dto.getProjectUuid()).isEqualTo(publicProject.uuid());
assertThat(dto.getQualifier()).isEqualTo(publicProject.qualifier());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void convertToDocs_empty() {
SearchHits hits = mock(SearchHits.class, Mockito.RETURNS_MOCKS);
List<BaseDoc> docs = EsUtils.convertToDocs(hits, IssueDoc::new);
assertThat(docs).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getAtMostThreeActiveUsersForScmAccount_is_case_sensitive_for_login() {
UserDoc user = newUser("the_login", singletonList("John.Smith"));
es.putDocuments(INDEX_TYPE_USER, user);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("the_login", ORGANIZATION_UUID)).hasSize(1);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("the_Login", ORGANIZATION_UUID)).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
private void assertSinglePostCall() {
Assertions.assertThat(postCalls).hasSize(1);
Assertions.assertThat(getRawCalls()).isEmpty();
Assertions.assertThat(rawCalls).isEmpty();
}
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldExitOnErrorFromFile()
throws IOException, InterruptedException
{
try (TempFile file = new TempFile()) {
Files.write("select * from hive.default.nations;\nselect * from hive.default.nation;\n", file.file(), UTF_8);
launchPrestoCliWithServerArgument("--file", file.file().getAbsolutePath());
assertThat(trimLines(presto.readRemainingOutputLines())).isEmpty();
assertThatThrownBy(() -> presto.waitForWithTimeoutAndKill()).hasMessage("Child process exited with non-zero code: 1");
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void return_404_if_resource_not_found_in_installed_plugin() throws Exception {
system.pluginStream = null;
when(pluginRepository.hasPlugin("myplugin")).thenReturn(true);
Response response = call("/static/myplugin/foo.css");
assertThat(response.code()).isEqualTo(404);
assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty();
assertThat(logTester.logs(LoggerLevel.WARN)).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void return_private_project_without_any_permission_when_no_permission_in_DB() {
List<IndexPermissions> dtos = underTest.selectByUuids(dbClient, dbSession, singletonList(privateProject1.uuid()));
// no permissions
Assertions.assertThat(dtos).hasSize(1);
IndexPermissions dto = dtos.get(0);
assertThat(dto.getGroupIds()).isEmpty();
assertThat(dto.getUserIds()).isEmpty();
assertThat(dto.isAllowAnyone()).isFalse();
assertThat(dto.getProjectUuid()).isEqualTo(privateProject1.uuid());
assertThat(dto.getQualifier()).isEqualTo(privateProject1.qualifier());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void return_404_if_plugin_does_not_exist() throws Exception {
system.pluginStream = null;
when(pluginRepository.hasPlugin("myplugin")).thenReturn(false);
Response response = call("/static/myplugin/foo.css");
assertThat(response.code()).isEqualTo(404);
assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty();
assertThat(logTester.logs(LoggerLevel.WARN)).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void deleteGroupAuthorityRemovesCorrectRows() throws Exception {
GrantedAuthority auth = new SimpleGrantedAuthority("ROLE_A");
manager.removeGroupAuthority("GROUP_0", auth);
assertThat(
template.queryForList(
"select authority from group_authorities where group_id = 0")).isEmpty();
manager.removeGroupAuthority("GROUP_2", auth);
assertThat(
template.queryForList(
"select authority from group_authorities where group_id = 2")).hasSize(2);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void visit_subView_with_depth_VIEW_does_not_call_visit_subView_nor_visitAny() {
Component component = component(SUBVIEW, 1);
viewCrawler.visit(component);
assertThat(viewVisitor.callsRecords).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getAtMostThreeActiveUsersForScmAccount_is_case_insensitive_for_email() {
UserDoc user = newUser("the_login", "the_EMAIL@corp.com", singletonList("John.Smith"));
es.putDocuments(INDEX_TYPE_USER, user);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("the_EMAIL@corp.com", ORGANIZATION_UUID)).hasSize(1);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("the_email@corp.com", ORGANIZATION_UUID)).hasSize(1);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("email", ORGANIZATION_UUID)).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void empty_pages_if_no_page_definition() {
underTest.start();
List<Page> result = underTest.getAllPages();
assertThat(result).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getAtMostThreeActiveUsersForScmAccount_is_case_insensitive_for_scm_account() {
UserDoc user = newUser("the_login", singletonList("John.Smith"));
es.putDocuments(INDEX_TYPE_USER, user);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("John.Smith", ORGANIZATION_UUID)).hasSize(1);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("JOHN.SMIth", ORGANIZATION_UUID)).hasSize(1);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("JOHN.SMITH", ORGANIZATION_UUID)).hasSize(1);
assertThat(underTest.getAtMostThreeActiveUsersForScmAccount("JOHN", ORGANIZATION_UUID)).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void visit_projectView_with_depth_SUBVIEW_does_not_call_visit_projectView_nor_visitAny() {
Component component = component(PROJECT_VIEW, 1);
subViewCrawler.visit(component);
assertThat(subViewVisitor.callsRecords).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void index_on_startup() {
db.prepareDbUnit(getClass(), "index.xml");
underTest.indexOnStartup(emptySet());
List<ViewDoc> docs = es.getDocuments(ViewIndexDefinition.INDEX_TYPE_VIEW, ViewDoc.class);
assertThat(docs).hasSize(4);
Map<String, ViewDoc> viewsByUuid = Maps.uniqueIndex(docs, ViewDoc::uuid);
assertThat(viewsByUuid.get("ABCD").projects()).containsOnly("JKLM");
assertThat(viewsByUuid.get("EFGH").projects()).containsOnly("KLMN", "JKLM");
assertThat(viewsByUuid.get("FGHI").projects()).containsOnly("JKLM");
assertThat(viewsByUuid.get("IJKL").projects()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void visit_projectView_with_depth_VIEW_does_not_call_visit_projectView_nor_visitAny() {
Component component = component(PROJECT_VIEW, 1);
viewCrawler.visit(component);
assertThat(viewVisitor.callsRecords).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void do_no_log_error_when_task_fails_with_MessageException() throws Exception {
CeTask ceTask = createCeTask(submitter);
when(queue.peek(anyString())).thenReturn(Optional.of(ceTask));
taskProcessorRepository.setProcessorForTask(CeTaskTypes.REPORT, taskProcessor);
makeTaskProcessorFail(ceTask, MessageException.of("simulate MessageException thrown by TaskProcessor#process"));
underTest.call();
List<String> logs = logTester.logs(LoggerLevel.INFO);
assertThat(logs).hasSize(2);
assertThat(logs.get(1)).contains(" | submitter=" + submitter.getLogin());
assertThat(logs.get(1)).contains(String.format(" | submitter=%s | status=FAILED | time=", submitter.getLogin()));
assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty();
}
内容来源于网络,如有侵权,请联系作者删除!