use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class CommentContextIT method commentContextForCommitMessageForLineComment.
@Test
public void commentContextForCommitMessageForLineComment() throws Exception {
PushOneCommit.Result result = createChange(testRepo, "master", SUBJECT, FILE_NAME, FILE_CONTENT, "topic");
String changeId = result.getChangeId();
String ps1 = result.getCommit().name();
CommentInput comment = CommentsUtil.newComment(COMMIT_MSG, Side.REVISION, 7, "comment", false);
CommentsUtil.addComments(gApi, changeId, ps1, comment);
List<CommentInfo> comments = gApi.changes().id(changeId).commentsRequest().withContext(true).getAsList();
assertThat(comments).hasSize(1);
// The first few lines of the commit message are the headers, e.g.
// Parent: ...
// Author: ...
// AuthorDate: ...
// etc...
assertThat(comments.get(0).contextLines).containsExactlyElementsIn(createContextLines("7", "Commit Header"));
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class CommentContextIT method commentContextIsEmptyForPatchsetLevelComments.
@Test
public void commentContextIsEmptyForPatchsetLevelComments() throws Exception {
PushOneCommit.Result result = createChange();
String changeId = result.getChangeId();
String ps1 = result.getCommit().name();
CommentInput comment = CommentsUtil.newCommentWithOnlyMandatoryFields(PATCHSET_LEVEL, "comment");
CommentsUtil.addComments(gApi, changeId, ps1, comment);
List<CommentInfo> comments = gApi.changes().id(changeId).commentsRequest().withContext(true).getAsList();
assertThat(comments).hasSize(1);
assertThat(comments.get(0).contextLines).isEmpty();
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class CommentsUtil method newComment.
static CommentInput newComment(String path, Side side, Comment.Range range, String message, Boolean unresolved) {
CommentInput c = new CommentInput();
c.unresolved = unresolved;
return populate(c, path, side, null, null, range, message);
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class CommentsUtil method newComment.
static CommentInput newComment(String path, Side side, int line, String message, Boolean unresolved) {
CommentInput c = new CommentInput();
c.unresolved = unresolved;
return populate(c, path, side, null, line, message);
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class CommentsUtil method newCommentWithOnlyMandatoryFields.
static CommentInput newCommentWithOnlyMandatoryFields(String path, String message) {
CommentInput c = new CommentInput();
c.unresolved = false;
return populate(c, path, null, null, null, null, message);
}
Aggregations