use of com.google.gerrit.extensions.api.changes.DraftApi in project gerrit by GerritCodeReview.
the class RevisionIT method drafts.
@Test
public void drafts() throws Exception {
PushOneCommit.Result r = createChange();
DraftInput in = new DraftInput();
in.line = 1;
in.message = "nit: trailing whitespace";
in.path = FILE_NAME;
DraftApi draftApi = gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).createDraft(in);
assertThat(draftApi.get().message).isEqualTo(in.message);
assertThat(gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).draft(draftApi.get().id).get().message).isEqualTo(in.message);
assertThat(gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).drafts()).hasSize(1);
in.message = "good catch!";
assertThat(gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).draft(draftApi.get().id).update(in).message).isEqualTo(in.message);
assertThat(gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).draft(draftApi.get().id).get().author.email).isEqualTo(admin.email);
draftApi.delete();
assertThat(gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).drafts()).isEmpty();
}
Aggregations