use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.
the class ChangeNotesTest method putRemoveAndAddBackReviewerByEmail.
@Test
public void putRemoveAndAddBackReviewerByEmail() throws Exception {
Address adr = Address.create("Foo Bar", "foo.bar@gerritcodereview.com");
Change c = newChange();
ChangeUpdate update = newUpdate(c, changeOwner);
update.putReviewerByEmail(adr, ReviewerStateInternal.REVIEWER);
update.commit();
update = newUpdate(c, changeOwner);
update.removeReviewerByEmail(adr);
update.commit();
update = newUpdate(c, changeOwner);
update.putReviewerByEmail(adr, ReviewerStateInternal.CC);
update.commit();
ChangeNotes notes = newNotes(c);
assertThat(notes.getReviewersByEmail().all()).containsExactly(adr);
}
use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.
the class FromAddressGeneratorProviderTest method USERAllowDomainTwice.
@Test
public void USERAllowDomainTwice() {
setFrom("USER");
setDomains(Arrays.asList("example.net"));
setDomains(Arrays.asList("example.com"));
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);
assertThat(r.email()).isEqualTo(email);
verifyAccountCacheGet(user);
}
use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.
the class FromAddressGeneratorProviderTest method MIXED_NoFullNameUser.
@Test
public void MIXED_NoFullNameUser() {
setFrom("MIXED");
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()).isEqualTo("Anonymous Coward (Code Review)");
assertThat(r.email()).isEqualTo(ident.getEmailAddress());
verifyAccountCacheGet(user);
}
use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.
the class FromAddressGeneratorProviderTest method CUSTOM_NoFullNameUser.
@Test
public void CUSTOM_NoFullNameUser() {
setFrom("A ${user} B <my.server@email.address>");
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()).isEqualTo("A Anonymous Coward B");
assertThat(r.email()).isEqualTo("my.server@email.address");
}
use of com.google.gerrit.entities.Address in project gerrit by GerritCodeReview.
the class FromAddressGeneratorProviderTest method SERVER_NullUser.
@Test
public void SERVER_NullUser() {
setFrom("SERVER");
final Address r = create().from(null);
assertThat(r).isNotNull();
assertThat(r.name()).isEqualTo(ident.getName());
assertThat(r.email()).isEqualTo(ident.getEmailAddress());
verifyNoInteractions(accountCache);
}
Aggregations