use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method metaDiff.
@Test
public void metaDiff() throws Exception {
PushOneCommit.Result ch = createChange();
ChangeApi chApi = gApi.changes().id(ch.getChangeId());
chApi.topic(TOPIC);
ChangeInfo oldInfo = chApi.get();
chApi.topic(TOPIC + "-2");
chApi.setHashtags(new HashtagsInput(ImmutableSet.of(HASHTAG)));
ChangeInfo newInfo = chApi.get();
ChangeInfoDifference difference = chApi.metaDiff(oldInfo.metaRevId, newInfo.metaRevId);
assertThat(difference.added().topic).isEqualTo(newInfo.topic);
assertThat(difference.added().hashtags).isNotNull();
assertThat(difference.added().hashtags).containsExactly(HASHTAG);
assertThat(difference.removed().topic).isEqualTo(oldInfo.topic);
assertThat(difference.removed().hashtags).isNull();
}
use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method staticField.
@Test
public void staticField() throws Exception {
PushOneCommit.Result result = createChange();
ReviewInput in = new ReviewInput();
in.message("hello");
requestScopeOperations.setApiUser(user.id());
gApi.changes().id(result.getChangeId()).revision("current").review(in);
ChangeApi chApi = gApi.changes().id(result.getChangeId());
ChangeInfoDifference difference = chApi.metaDiff(null, null, ListChangesOption.LABELS);
assertThat(difference.added().reviewers).containsKey(ReviewerState.CC);
assertThat(difference.added().reviewers).hasSize(1);
Collection<AccountInfo> reviewers = difference.added().reviewers.get(ReviewerState.CC);
assertThat(reviewers).hasSize(1);
AccountInfo info = reviewers.iterator().next();
assertThat(info._accountId).isEqualTo(user.id().get());
}
use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method metaDiffNoNewMetaGivenUsesCurrentPatchSet.
@Test
public void metaDiffNoNewMetaGivenUsesCurrentPatchSet() throws Exception {
PushOneCommit.Result ch = createChange();
ChangeApi chApi = gApi.changes().id(ch.getChangeId());
ChangeInfo oldInfo = chApi.get();
chApi.topic(TOPIC);
ChangeInfoDifference difference = chApi.metaDiff(oldInfo.metaRevId, null);
assertThat(difference.added().topic).isEqualTo(TOPIC);
assertThat(difference.removed().topic).isNull();
}
Aggregations