use of com.google.gerrit.testing.FakeEmailSender.Message in project gerrit by GerritCodeReview.
the class AbstractDaemonTest method assertNotifyCc.
protected void assertNotifyCc(Address expectedAddress) {
assertThat(sender.getMessages()).hasSize(1);
Message m = sender.getMessages().get(0);
assertThat(m.rcpt()).containsExactly(expectedAddress);
assertThat(m.headers().get("To").isEmpty()).isTrue();
assertThat(((EmailHeader.AddressList) m.headers().get("Cc")).getAddressList()).containsExactly(expectedAddress);
}
use of com.google.gerrit.testing.FakeEmailSender.Message in project gerrit by GerritCodeReview.
the class AbstractDaemonTest method assertNotifyTo.
protected void assertNotifyTo(String expectedEmail, String expectedFullname) {
Address expectedAddress = Address.create(expectedFullname, expectedEmail);
assertThat(sender.getMessages()).hasSize(1);
Message m = sender.getMessages().get(0);
assertThat(m.rcpt()).containsExactly(expectedAddress);
assertThat(((EmailHeader.AddressList) m.headers().get("To")).getAddressList()).containsExactly(expectedAddress);
assertThat(m.headers().get("Cc").isEmpty()).isTrue();
}
use of com.google.gerrit.testing.FakeEmailSender.Message in project gerrit by GerritCodeReview.
the class AbstractDaemonTest method assertNotifyBcc.
protected void assertNotifyBcc(TestAccount expected) {
assertThat(sender.getMessages()).hasSize(1);
Message m = sender.getMessages().get(0);
assertThat(m.rcpt()).containsExactly(expected.getNameEmail());
assertThat(m.headers().get("To").isEmpty()).isTrue();
assertThat(m.headers().get("Cc").isEmpty()).isTrue();
}
use of com.google.gerrit.testing.FakeEmailSender.Message in project gerrit by GerritCodeReview.
the class AbstractDaemonTest method assertNotifyBcc.
protected void assertNotifyBcc(String expectedEmail, String expectedFullName) {
assertThat(sender.getMessages()).hasSize(1);
Message m = sender.getMessages().get(0);
assertThat(m.rcpt()).containsExactly(Address.create(expectedFullName, expectedEmail));
assertThat(m.headers().get("To").isEmpty()).isTrue();
assertThat(m.headers().get("Cc").isEmpty()).isTrue();
}
use of com.google.gerrit.testing.FakeEmailSender.Message in project gerrit by GerritCodeReview.
the class CommentsIT method commentsOnDeletedFileIsIncludedInEmails.
@Test
public void commentsOnDeletedFileIsIncludedInEmails() throws Exception {
// Create a change with a file.
createChange("subject", "f1.txt", "content");
// Stack a second change that deletes the file.
PushOneCommit.Result r = createChange();
String changeId = r.getChangeId();
gApi.changes().id(changeId).edit().deleteFile("f1.txt");
gApi.changes().id(changeId).edit().publish();
String currentRevision = gApi.changes().id(changeId).get().currentRevision;
// Add a comment on the deleted file on the parent side.
email.clear();
CommentInput commentInput = CommentsUtil.newComment("f1.txt", Side.PARENT, /* line= */
1, /* message= */
"Comment text", /* unresolved= */
false);
CommentsUtil.addComments(gApi, changeId, currentRevision, commentInput);
// Assert email contains the comment text.
assertThat(email.getMessages()).hasSize(1);
Message commentMessage = email.getMessages().get(0);
assertThat(commentMessage.body()).contains("Patch Set 2:\n\n(1 comment)\n\nFile f1.txt:");
assertThat(commentMessage.body()).contains("PS2, Line 1: content\nComment text");
}
Aggregations