本文整理了Java中org.assertj.core.api.ListAssert.containsAll()
方法的一些代码示例,展示了ListAssert.containsAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.containsAll()
方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:containsAll
暂无
代码示例来源:origin: prestodb/presto
@Test(groups = {LDAP, LDAP_CLI, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT)
public void shouldRunQueryFromFileWithLdap()
throws IOException
{
File temporayFile = File.createTempFile("test-sql", null);
temporayFile.deleteOnExit();
Files.write("select * from hive.default.nation;\n", temporayFile, UTF_8);
launchPrestoCliWithServerArgument("--file", temporayFile.getAbsolutePath());
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
}
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldNotExitOnErrorFromExecute()
throws IOException, InterruptedException
{
String sql = "select * from hive.default.nations; select * from hive.default.nation;";
launchPrestoCliWithServerArgument("--execute", sql, "--ignore-errors");
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
assertThatThrownBy(() -> presto.waitForWithTimeoutAndKill()).hasMessage("Child process exited with non-zero code: 1");
}
代码示例来源:origin: prestodb/presto
@Test(groups = {LDAP, LDAP_CLI, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT)
public void shouldRunBatchQueryWithLdap()
throws IOException
{
launchPrestoCliWithServerArgument("--execute", "select * from hive.default.nation;");
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
}
代码示例来源:origin: prestodb/presto
@Test(groups = {LDAP, LDAP_CLI, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT)
public void shouldPassQueryForLdapUserInMultipleGroups()
throws IOException
{
ldapUserName = USER_IN_MULTIPLE_GROUPS.getAttributes().get("cn");
launchPrestoCliWithServerArgument("--catalog", "hive", "--schema", "default", "--execute", "select * from nation;");
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
}
代码示例来源:origin: prestodb/presto
@Test(groups = {LDAP, LDAP_CLI, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT)
public void shouldRunQueryWithLdap()
throws IOException
{
launchPrestoCliWithServerArgument();
presto.waitForPrompt();
presto.getProcessInput().println("select * from hive.default.nation;");
assertThat(trimLines(presto.readLinesUntilPrompt())).containsAll(nationTableInteractiveLines);
}
代码示例来源:origin: prestodb/presto
@Test(groups = {LDAP, LDAP_CLI, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT)
public void shouldPassForCredentialsWithSpecialCharacters()
throws IOException
{
ldapUserName = SPECIAL_USER.getAttributes().get("cn");
ldapUserPassword = SPECIAL_USER.getAttributes().get("userPassword");
launchPrestoCliWithServerArgument("--catalog", "hive", "--schema", "default", "--execute", "select * from nation;");
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
}
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldNotExitOnErrorFromFile()
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(), "--ignore-errors");
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
assertThatThrownBy(() -> presto.waitForWithTimeoutAndKill()).hasMessage("Child process exited with non-zero code: 1");
}
}
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldRunBatchQuery()
throws Exception
{
launchPrestoCliWithServerArgument("--execute", "select * from hive.default.nation;");
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
presto.waitForWithTimeoutAndKill();
}
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldUseCatalogAndSchemaOptions()
throws Exception
{
launchPrestoCliWithServerArgument("--catalog", "hive", "--schema", "default", "--execute", "select * from nation;");
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
presto.waitForWithTimeoutAndKill();
}
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldRunQueryFromFile()
throws Exception
{
try (TempFile file = new TempFile()) {
Files.write("select * from hive.default.nation;\n", file.file(), UTF_8);
launchPrestoCliWithServerArgument("--file", file.file().getAbsolutePath());
assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
presto.waitForWithTimeoutAndKill();
}
}
代码示例来源:origin: cbeust/testng
@Test
public void testMultipleTestMethodsShareSameDataProvider() {
Class<?> clazz = TwoTestMethodsShareSameDataProviderSample.class;
runTest(1, clazz);
String[] prefixes = {"before", "after"};
String[] methods = {"testHowMuchMasterShifuAte", "testHowMuchPoAte"};
List<String> expected = new ArrayList<>();
for (String prefix : prefixes) {
for (String method : methods) {
String txt = prefix + ":" + clazz.getName() + "." + method;
expected.add(txt);
}
}
assertThat(InstanceAwareLocalDataProviderListener.messages).containsAll(expected);
}
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldHandleSession()
throws IOException
{
launchPrestoCliWithServerArgument();
presto.waitForPrompt();
presto.getProcessInput().println("use hive.default;");
assertThat(presto.readLinesUntilPrompt()).contains("USE");
presto.getProcessInput().println("select * from nation;");
assertThat(trimLines(presto.readLinesUntilPrompt())).containsAll(nationTableInteractiveLines);
presto.getProcessInput().println("show session;");
assertThat(squeezeLines(presto.readLinesUntilPrompt()))
.contains("join_distribution_type|PARTITIONED|PARTITIONED|varchar|The join method to use. Options are BROADCAST,PARTITIONED,AUTOMATIC");
presto.getProcessInput().println("set session join_distribution_type = 'BROADCAST';");
assertThat(presto.readLinesUntilPrompt()).contains("SET SESSION");
presto.getProcessInput().println("show session;");
assertThat(squeezeLines(presto.readLinesUntilPrompt()))
.contains("join_distribution_type|BROADCAST|PARTITIONED|varchar|The join method to use. Options are BROADCAST,PARTITIONED,AUTOMATIC");
}
代码示例来源:origin: spring-projects/spring-security
/**
* This uses a naming convention for the ids of the appendix to ensure that the entire appendix is documented.
* The naming convention for the ids is documented in {@link Element#getIds()}.
* @return
*/
@Test
public void countReferencesWhenReviewingDocumentationThenEntireSchemaIsIncluded()
throws IOException {
Map<String, Element> elementsByElementName =
this.xml.elementsByElementName(this.schemaDocumentLocation);
List<String> documentIds =
Files.lines(Paths.get(this.referenceLocation))
.filter(line -> line.matches("\\[\\[(nsa-.*)\\]\\]"))
.map(line -> line.substring(2, line.length() - 2))
.collect(Collectors.toList());
Set<String> expectedIds =
elementsByElementName.values().stream()
.flatMap(element -> element.getIds().stream())
.collect(Collectors.toSet());
documentIds.removeAll(this.ignoredIds);
expectedIds.removeAll(this.ignoredIds);
assertThat(documentIds).containsAll(expectedIds);
assertThat(expectedIds).containsAll(documentIds);
}
代码示例来源:origin: prestodb/presto
assertThat(trimLines(presto.readLinesUntilPrompt())).containsAll(nationTableInteractiveLines);
代码示例来源:origin: SonarSource/sonarqube
private void verifyStillHasAllPermissions(ComponentDto component, UserDto user, GroupDto group) {
assertThat(dbClient.groupPermissionDao().selectGlobalPermissionsOfGroup(dbSession, component.getOrganizationUuid(), null))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.groupPermissionDao().selectGlobalPermissionsOfGroup(dbSession, component.getOrganizationUuid(), group.getId()))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.userPermissionDao().selectGlobalPermissionsOfUser(dbSession, user.getId(), component.getOrganizationUuid()))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession, component.getOrganizationUuid(), null, component.getId()))
.containsAll(permissionService.getAllProjectPermissions());
assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession, component.getOrganizationUuid(), group.getId(), component.getId()))
.containsAll(permissionService.getAllProjectPermissions());
assertThat(dbClient.userPermissionDao().selectProjectPermissionsOfUser(dbSession, user.getId(), component.getId()))
.containsAll(permissionService.getAllProjectPermissions());
}
代码示例来源:origin: SonarSource/sonarqube
private void verifyHasAllPermissionsButProjectPermissionsToGroupAnyOne(ComponentDto component, UserDto user, GroupDto group) {
assertThat(dbClient.groupPermissionDao().selectGlobalPermissionsOfGroup(dbSession, component.getOrganizationUuid(), null))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.groupPermissionDao().selectGlobalPermissionsOfGroup(dbSession, component.getOrganizationUuid(), group.getId()))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.userPermissionDao().selectGlobalPermissionsOfUser(dbSession, user.getId(), component.getOrganizationUuid()))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession, component.getOrganizationUuid(), null, component.getId()))
.isEmpty();
assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession, component.getOrganizationUuid(), group.getId(), component.getId()))
.containsAll(permissionService.getAllProjectPermissions());
assertThat(dbClient.userPermissionDao().selectProjectPermissionsOfUser(dbSession, user.getId(), component.getId()))
.containsAll(permissionService.getAllProjectPermissions());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void update_only_login_of_local_account() {
UserDto user = db.users().insertUser(newLocalUser(DEFAULT_LOGIN, "Marius", "marius@lesbronzes.fr"));
createDefaultGroup();
underTest.updateAndCommit(session, user, new UpdateUser()
.setLogin("new_login"), u -> {
});
assertThat(dbClient.userDao().selectByLogin(session, DEFAULT_LOGIN)).isNull();
UserDto userReloaded = dbClient.userDao().selectByUuid(session, user.getUuid());
assertThat(userReloaded.getLogin()).isEqualTo("new_login");
assertThat(userReloaded.getExternalIdentityProvider()).isEqualTo("sonarqube");
assertThat(userReloaded.getExternalLogin()).isEqualTo("new_login");
assertThat(userReloaded.getExternalId()).isEqualTo("new_login");
// Following fields has not changed
assertThat(userReloaded.isLocal()).isTrue();
assertThat(userReloaded.getName()).isEqualTo(user.getName());
assertThat(userReloaded.getEmail()).isEqualTo(user.getEmail());
assertThat(userReloaded.getScmAccountsAsList()).containsAll(user.getScmAccountsAsList());
assertThat(userReloaded.getSalt()).isEqualTo(user.getSalt());
assertThat(userReloaded.getCryptedPassword()).isEqualTo(user.getCryptedPassword());
}
代码示例来源:origin: SonarSource/sonarqube
private void verifyHasAllPermissionsButProjectPermissionsUserAndBrowse(ComponentDto component, UserDto user, GroupDto group) {
assertThat(dbClient.groupPermissionDao().selectGlobalPermissionsOfGroup(dbSession, component.getOrganizationUuid(), null))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.groupPermissionDao().selectGlobalPermissionsOfGroup(dbSession, component.getOrganizationUuid(), group.getId()))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.userPermissionDao().selectGlobalPermissionsOfUser(dbSession, user.getId(), component.getOrganizationUuid()))
.containsAll(ORGANIZATION_PERMISSIONS_NAME_SET);
assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession, component.getOrganizationUuid(), null, component.getId()))
.doesNotContain(UserRole.USER)
.doesNotContain(UserRole.CODEVIEWER)
.containsAll(PROJECT_PERMISSIONS_BUT_USER_AND_CODEVIEWER);
assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession, component.getOrganizationUuid(), group.getId(), component.getId()))
.doesNotContain(UserRole.USER)
.doesNotContain(UserRole.CODEVIEWER)
.containsAll(PROJECT_PERMISSIONS_BUT_USER_AND_CODEVIEWER);
assertThat(dbClient.userPermissionDao().selectProjectPermissionsOfUser(dbSession, user.getId(), component.getId()))
.doesNotContain(UserRole.USER)
.doesNotContain(UserRole.CODEVIEWER)
.containsAll(PROJECT_PERMISSIONS_BUT_USER_AND_CODEVIEWER);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void update_only_login_of_external_account() {
UserDto user = db.users().insertUser(newExternalUser(DEFAULT_LOGIN, "Marius", "marius@lesbronzes.fr"));
createDefaultGroup();
underTest.updateAndCommit(session, user, new UpdateUser()
.setLogin("new_login"), u -> {
});
assertThat(dbClient.userDao().selectByLogin(session, DEFAULT_LOGIN)).isNull();
UserDto userReloaded = dbClient.userDao().selectByUuid(session, user.getUuid());
assertThat(userReloaded.getLogin()).isEqualTo("new_login");
// Following fields has not changed
assertThat(userReloaded.isLocal()).isFalse();
assertThat(userReloaded.getExternalLogin()).isEqualTo(user.getExternalLogin());
assertThat(userReloaded.getExternalId()).isEqualTo(user.getExternalId());
assertThat(userReloaded.getName()).isEqualTo(user.getName());
assertThat(userReloaded.getEmail()).isEqualTo(user.getEmail());
assertThat(userReloaded.getScmAccountsAsList()).containsAll(user.getScmAccountsAsList());
assertThat(userReloaded.getSalt()).isEqualTo(user.getSalt());
assertThat(userReloaded.getCryptedPassword()).isEqualTo(user.getCryptedPassword());
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testUploadTriggerInstance() {
final TriggerInstance expectedTriggerInst = this.createTriggerInstance(this.flowTrigger, this
.flow_id, this.flow_version, this.submitUser, this.project, System.currentTimeMillis());
this.triggerInstLoader.uploadTriggerInstance(expectedTriggerInst);
final TriggerInstance actualTriggerInst = this.triggerInstLoader
.getTriggerInstanceById(expectedTriggerInst.getId());
assertThat(expectedTriggerInst.getFlowTrigger().toString())
.isEqualToIgnoringWhitespace(actualTriggerInst.getFlowTrigger().toString());
assertThat(expectedTriggerInst).isEqualToIgnoringGivenFields(actualTriggerInst,
"depInstances", "flowTrigger");
assertThat(expectedTriggerInst.getDepInstances())
.usingElementComparatorIgnoringFields("triggerInstance", "context")
.containsAll(actualTriggerInst.getDepInstances())
.hasSameSizeAs(actualTriggerInst.getDepInstances());
}
内容来源于网络,如有侵权,请联系作者删除!