Merge changes Id112b701,Ia33389c5

* changes:
  Allow to explicitly specify whom to notify on a change update
  Test that watchers are notified for new changes only if notify is ALL
This commit is contained in:
Dave Borowitz
2016-12-08 15:04:17 +00:00
committed by Gerrit Code Review
45 changed files with 672 additions and 127 deletions

View File

@@ -892,6 +892,13 @@ public abstract class AbstractDaemonTest {
.review(ReviewInput.approve());
}
protected void recommend(String id) throws Exception {
gApi.changes()
.id(id)
.revision("current")
.review(ReviewInput.recommend());
}
protected Map<String, ActionInfo> getActions(String id) throws Exception {
return gApi.changes()
.id(id)
@@ -1171,4 +1178,32 @@ public abstract class AbstractDaemonTest {
.containsExactlyElementsIn(Arrays.asList(expected));
}
}
protected void assertNotifyTo(TestAccount expected) {
assertThat(sender.getMessages()).hasSize(1);
Message m = sender.getMessages().get(0);
assertThat(m.rcpt()).containsExactly(expected.emailAddress);
assertThat(
((EmailHeader.AddressList) m.headers().get("To")).getAddressList())
.containsExactly(expected.emailAddress);
assertThat(m.headers().get("CC").isEmpty()).isTrue();
}
protected void assertNotifyCc(TestAccount expected) {
assertThat(sender.getMessages()).hasSize(1);
Message m = sender.getMessages().get(0);
assertThat(m.rcpt()).containsExactly(expected.emailAddress);
assertThat(m.headers().get("To").isEmpty()).isTrue();
assertThat(
((EmailHeader.AddressList) m.headers().get("CC")).getAddressList())
.containsExactly(expected.emailAddress);
}
protected void assertNotifyBcc(TestAccount expected) {
assertThat(sender.getMessages()).hasSize(1);
Message m = sender.getMessages().get(0);
assertThat(m.rcpt()).containsExactly(expected.emailAddress);
assertThat(m.headers().get("To").isEmpty()).isTrue();
assertThat(m.headers().get("CC").isEmpty()).isTrue();
}
}