Search in sources :

Example 16 with Result

use of com.google.gerrit.server.account.AccountResolver.Result in project gerrit by GerritCodeReview.

the class AccountResolverTest method exceptionMessageAmbiguous.

@Test
public void exceptionMessageAmbiguous() throws Exception {
    AccountResolver resolver = newAccountResolver();
    assertThat(new UnresolvableAccountException(resolver.new Result("foo", ImmutableList.of(newAccount(3), newAccount(1)), ImmutableList.of()))).hasMessageThat().isEqualTo("Account 'foo' is ambiguous (at most 3 shown):\n1: Anonymous Name (1)\n3: Anonymous Name (3)");
}
Also used : UnresolvableAccountException(com.google.gerrit.server.account.AccountResolver.UnresolvableAccountException) Result(com.google.gerrit.server.account.AccountResolver.Result) Test(org.junit.Test)

Example 17 with Result

use of com.google.gerrit.server.account.AccountResolver.Result in project gerrit by GerritCodeReview.

the class AccountResolverIT method bySelfInactive.

@Test
public void bySelfInactive() throws Exception {
    gApi.accounts().id(user.id().get()).setActive(false);
    requestScopeOperations.setApiUser(user.id());
    assertThat(gApi.accounts().id("self").getActive()).isFalse();
    Result result = resolveAsResult("self");
    assertThat(result.asIdSet()).containsExactly(user.id());
    assertThat(result.isSelf()).isTrue();
    assertThat(result.asUniqueUser()).isSameInstanceAs(self.get());
}
Also used : Result(com.google.gerrit.server.account.AccountResolver.Result) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Aggregations

Result (com.google.gerrit.server.account.AccountResolver.Result)17 Test (org.junit.Test)16 Searcher (com.google.gerrit.server.account.AccountResolver.Searcher)8 StringSearcher (com.google.gerrit.server.account.AccountResolver.StringSearcher)8 UnresolvableAccountException (com.google.gerrit.server.account.AccountResolver.UnresolvableAccountException)7 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)3 TestAccount (com.google.gerrit.acceptance.testsuite.account.TestAccount)1 Account (com.google.gerrit.entities.Account)1