Search in sources :

Example 56 with Address

use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.

the class FromAddressGeneratorProviderTest method USER_NoFullNameUser.

@Test
public void USER_NoFullNameUser() {
    setFrom("USER");
    final String email = "a.u.thor@test.example.com";
    final Account.Id user = user(null, email);
    final Address r = create().from(user);
    assertThat(r).isNotNull();
    assertThat(r.name()).isNull();
    assertThat(r.email()).isEqualTo(email);
    verifyAccountCacheGet(user);
}
Also used : Account(com.google.gerrit.entities.Account) Address(com.google.gerrit.entities.Address) Test(org.junit.Test)

Example 57 with Address

use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.

the class FromAddressGeneratorProviderTest method USERNoAllowDomain.

@Test
public void USERNoAllowDomain() {
    setFrom("USER");
    setDomains(Arrays.asList("example.net"));
    final String name = "A U. Thor";
    final String email = "a.u.thor@example.com";
    final Account.Id user = user(name, email);
    final Address r = create().from(user);
    assertThat(r).isNotNull();
    assertThat(r.name()).isEqualTo(name + " (Code Review)");
    assertThat(r.email()).isEqualTo(ident.getEmailAddress());
    verifyAccountCacheGet(user);
}
Also used : Account(com.google.gerrit.entities.Account) Address(com.google.gerrit.entities.Address) Test(org.junit.Test)

Example 58 with Address

use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.

the class FromAddressGeneratorProviderTest method SERVER_FullyConfiguredUser.

@Test
public void SERVER_FullyConfiguredUser() {
    setFrom("SERVER");
    final String name = "A U. Thor";
    final String email = "a.u.thor@test.example.com";
    final Account.Id user = userNoLookup(name, email);
    final Address r = create().from(user);
    assertThat(r).isNotNull();
    assertThat(r.name()).isEqualTo(ident.getName());
    assertThat(r.email()).isEqualTo(ident.getEmailAddress());
    verifyNoInteractions(accountCache);
}
Also used : Account(com.google.gerrit.entities.Account) Address(com.google.gerrit.entities.Address) Test(org.junit.Test)

Example 59 with Address

use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.

the class FromAddressGeneratorProviderTest method CUSTOM_NullUser.

@Test
public void CUSTOM_NullUser() {
    setFrom("A ${user} B <my.server@email.address>");
    final Address r = create().from(null);
    assertThat(r).isNotNull();
    assertThat(r.name()).isEqualTo(ident.getName());
    assertThat(r.email()).isEqualTo("my.server@email.address");
}
Also used : Address(com.google.gerrit.entities.Address) Test(org.junit.Test)

Example 60 with Address

use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.

the class FromAddressGeneratorProviderTest method MIXED_FullyConfiguredUser.

@Test
public void MIXED_FullyConfiguredUser() {
    setFrom("MIXED");
    final String name = "A U. Thor";
    final String email = "a.u.thor@test.example.com";
    final Account.Id user = user(name, email);
    final Address r = create().from(user);
    assertThat(r).isNotNull();
    assertThat(r.name()).isEqualTo(name + " (Code Review)");
    assertThat(r.email()).isEqualTo(ident.getEmailAddress());
    verifyAccountCacheGet(user);
}
Also used : Account(com.google.gerrit.entities.Account) Address(com.google.gerrit.entities.Address) Test(org.junit.Test)

Aggregations

Address (com.google.gerrit.entities.Address)61 Test (org.junit.Test)45 Account (com.google.gerrit.entities.Account)22 Change (com.google.gerrit.entities.Change)9 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)7 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)7 NotifyConfig (com.google.gerrit.entities.NotifyConfig)6 Message (com.google.gerrit.testing.FakeEmailSender.Message)5 ArrayList (java.util.ArrayList)5 ReviewerStateInternal (com.google.gerrit.server.notedb.ReviewerStateInternal)4 ImmutableList (com.google.common.collect.ImmutableList)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 ImmutableTable (com.google.common.collect.ImmutableTable)2 Lists (com.google.common.collect.Lists)2 Table (com.google.common.collect.Table)2 FluentLogger (com.google.common.flogger.FluentLogger)2 Truth.assertWithMessage (com.google.common.truth.Truth.assertWithMessage)2 GroupReference (com.google.gerrit.entities.GroupReference)2 PatchSet (com.google.gerrit.entities.PatchSet)2