use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PortedCommentsIT method portedCommentHasOriginalPatchsetCommitId.
@Test
public void portedCommentHasOriginalPatchsetCommitId() throws Exception {
// Set up change and patchsets.
Change.Id changeId = changeOps.newChange().create();
TestPatchset patchset1 = changeOps.change(changeId).currentPatchset().get();
PatchSet.Id patchset2Id = changeOps.change(changeId).newPatchset().create();
// Add comment.
String commentUuid = newComment(patchset1.patchsetId()).create();
CommentInfo portedComment = getPortedComment(patchset2Id, commentUuid);
assertThat(portedComment).commitId().isEqualTo(patchset1.commitId().name());
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PortedCommentsIT method portedRangeCommentEndingWithinModifiedLineBecomesFileComment.
@Test
public void portedRangeCommentEndingWithinModifiedLineBecomesFileComment() throws Exception {
// Set up change and patchsets.
Change.Id changeId = changeOps.newChange().file("myFile").content("Line 1\nLine 2\nLine 3\nLine 4\n").create();
PatchSet.Id patchset1Id = changeOps.change(changeId).currentPatchset().get().patchsetId();
PatchSet.Id patchset2Id = changeOps.change(changeId).newPatchset().file("myFile").content("Line 1\nLine 2\nLine three\nLine 4\n").create();
// Add comment.
String commentUuid = newComment(patchset1Id).fromLine(1).charOffset(2).toLine(3).charOffset(4).ofFile("myFile").create();
CommentInfo portedComment = getPortedComment(patchset2Id, commentUuid);
assertThat(portedComment).range().isNull();
assertThat(portedComment).line().isNull();
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PortedCommentsIT method portedRangeCommentEndingOnLineJustBeforeModificationCanBePorted.
@Test
public void portedRangeCommentEndingOnLineJustBeforeModificationCanBePorted() throws Exception {
// Set up change and patchsets.
Change.Id changeId = changeOps.newChange().file("myFile").content("Line 1\nLine 2\nLine 3\nLine 4\n").create();
PatchSet.Id patchset1Id = changeOps.change(changeId).currentPatchset().get().patchsetId();
PatchSet.Id patchset2Id = changeOps.change(changeId).newPatchset().file("myFile").content("Line 1\nLine 2\nLine three\nLine 4\n").create();
// Add comment.
String commentUuid = newComment(patchset1Id).fromLine(1).charOffset(2).toLine(2).charOffset(5).ofFile("myFile").create();
CommentInfo portedComment = getPortedComment(patchset2Id, commentUuid);
assertThat(portedComment).range().startLine().isEqualTo(1);
assertThat(portedComment).range().startCharacter().isEqualTo(2);
assertThat(portedComment).range().endLine().isEqualTo(2);
assertThat(portedComment).range().endCharacter().isEqualTo(5);
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PortedCommentsIT method portedDraftCommentHasNoAuthor.
@Test
public void portedDraftCommentHasNoAuthor() throws Exception {
// Set up change and patchsets.
Account.Id authorId = accountOps.newAccount().create();
Change.Id changeId = changeOps.newChange().create();
PatchSet.Id patchset1Id = changeOps.change(changeId).currentPatchset().get().patchsetId();
PatchSet.Id patchset2Id = changeOps.change(changeId).newPatchset().create();
// Add comment.
String commentUuid = newDraftComment(patchset1Id).author(authorId).create();
Map<String, List<CommentInfo>> portedComments = getPortedDraftCommentsOfUser(patchset2Id, authorId);
CommentInfo portedComment = extractSpecificComment(portedComments, commentUuid);
// Authors of draft comments are never set.
assertThat(portedComment).author().isNull();
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PortedCommentsIT method whitespaceOnlyModificationsAreAlsoConsideredWhenPorting.
@Test
public void whitespaceOnlyModificationsAreAlsoConsideredWhenPorting() throws Exception {
// Set up change and patchsets.
Change.Id changeId = changeOps.newChange().file("myFile").content("Line 1\n").create();
PatchSet.Id patchset1Id = changeOps.change(changeId).currentPatchset().get().patchsetId();
PatchSet.Id patchset2Id = changeOps.change(changeId).newPatchset().file("myFile").content("\nLine 1\n").create();
// Add comment.
String commentUuid = newComment(patchset1Id).onLine(1).ofFile("myFile").create();
CommentInfo portedComment = getPortedComment(patchset2Id, commentUuid);
assertThat(portedComment).line().isEqualTo(2);
}
Aggregations