use of com.google.gerrit.extensions.client.ReviewerState.CC in project gerrit by GerritCodeReview.
the class ChangeIT method implicitlyAddReviewerOnVotingReview.
@Test
public void implicitlyAddReviewerOnVotingReview() throws Exception {
PushOneCommit.Result r = createChange();
setApiUser(user);
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).review(ReviewInput.recommend().message("LGTM"));
ChangeInfo c = gApi.changes().id(r.getChangeId()).get();
assertThat(c.reviewers.get(REVIEWER).stream().map(ai -> ai._accountId).collect(toList())).containsExactly(user.id.get());
// Further test: remove the vote, then comment again. The user should be
// implicitly re-added to the ReviewerSet, as a CC if we're using NoteDb.
setApiUser(admin);
gApi.changes().id(r.getChangeId()).reviewer(user.getId().toString()).remove();
c = gApi.changes().id(r.getChangeId()).get();
assertThat(c.reviewers.values()).isEmpty();
setApiUser(user);
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).review(new ReviewInput().message("hi"));
c = gApi.changes().id(r.getChangeId()).get();
ReviewerState state = notesMigration.readChanges() ? CC : REVIEWER;
assertThat(c.reviewers.get(state).stream().map(ai -> ai._accountId).collect(toList())).containsExactly(user.id.get());
}
Aggregations