TestAccount: Add method to get all emails
At the moment TestAccount only provides the preferred email, but accounts can have more emails linked via external IDs. This change doesn't include a test for the new method, since the complete account test API is untested and adding tests for this is out-of-scope for this change. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Ib60243df686f434b08ef0825441c8774898304ee
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.acceptance.testsuite.account;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
|
||||
import com.google.gerrit.entities.Account;
|
||||
import com.google.gerrit.server.ServerInitiated;
|
||||
@@ -136,6 +137,7 @@ public class AccountOperationsImpl implements AccountOperations {
|
||||
.fullname(Optional.ofNullable(account.fullName()))
|
||||
.username(accountState.userName())
|
||||
.active(accountState.account().isActive())
|
||||
.emails(ExternalId.getEmails(accountState.externalIds()).collect(toImmutableSet()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.acceptance.testsuite.account;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gerrit.entities.Account;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -30,6 +31,8 @@ public abstract class TestAccount {
|
||||
|
||||
public abstract boolean active();
|
||||
|
||||
public abstract ImmutableSet<String> emails();
|
||||
|
||||
static Builder builder() {
|
||||
return new AutoValue_TestAccount.Builder();
|
||||
}
|
||||
@@ -46,6 +49,8 @@ public abstract class TestAccount {
|
||||
|
||||
abstract Builder active(boolean active);
|
||||
|
||||
abstract Builder emails(ImmutableSet<String> emails);
|
||||
|
||||
abstract TestAccount build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user