use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method requestedThreadsAreEmptyIfReplyDoesNotReferToAThread.
@Test
public void requestedThreadsAreEmptyIfReplyDoesNotReferToAThread() {
HumanComment root = createComment("root");
HumanComment reply = asReply(createComment("reply"), "invalid");
ImmutableList<HumanComment> comments = ImmutableList.of(root);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreadsForChildren(ImmutableList.of(reply));
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of();
assertThat(commentThreads).isEqualTo(expectedThreads);
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method threadsIgnoreDuplicateRoots.
@Test
public void threadsIgnoreDuplicateRoots() {
HumanComment root = createComment("root");
HumanComment child1 = asReply(createComment("child1"), "root");
ImmutableList<HumanComment> comments = ImmutableList.of(root, root, child1);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreads();
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(root, child1));
assertThat(commentThreads).isEqualTo(expectedThreads);
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method commentsAreOrderedIntoCorrectThreads.
@Test
public void commentsAreOrderedIntoCorrectThreads() {
HumanComment thread1Root = createComment("thread1Root");
HumanComment thread1Child1 = asReply(createComment("thread1Child1"), "thread1Root");
HumanComment thread1Child2 = asReply(createComment("thread1Child2"), "thread1Child1");
HumanComment thread2Root = createComment("thread2Root");
HumanComment thread2Child1 = asReply(createComment("thread2Child1"), "thread2Root");
ImmutableList<HumanComment> comments = ImmutableList.of(thread2Root, thread1Child2, thread1Child1, thread1Root, thread2Child1);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreads();
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(thread1Root, thread1Child1, thread1Child2), toThread(thread2Root, thread2Child1));
assertThat(commentThreads).isEqualTo(expectedThreads);
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class ChangeNotesTest method patchLineCommentsFileComment.
@Test
public void patchLineCommentsFileComment() throws Exception {
Change c = newChange();
ChangeUpdate update = newUpdate(c, otherUser);
PatchSet.Id psId = c.currentPatchSetId();
ObjectId commitId = ObjectId.fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
HumanComment comment = newComment(psId, "file1", "uuid", null, 0, otherUser, null, TimeUtil.now(), "message", (short) 1, commitId, false);
update.setPatchSetId(psId);
update.putComment(HumanComment.Status.PUBLISHED, comment);
update.commit();
ChangeNotes notes = newNotes(c);
assertThat(notes.getHumanComments()).isEqualTo(ImmutableListMultimap.of(commitId, comment));
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class ChangeNotesTest method tagInlineComments.
@Test
public void tagInlineComments() throws Exception {
String tag = "jenkins";
Change c = newChange();
RevCommit commit = tr.commit().message("PS2").create();
ChangeUpdate update = newUpdate(c, changeOwner);
update.putComment(HumanComment.Status.PUBLISHED, newComment(c.currentPatchSetId(), "a.txt", "uuid1", new CommentRange(1, 2, 3, 4), 1, changeOwner, null, TimeUtil.now(), "Comment", (short) 1, commit, false));
update.setTag(tag);
update.commit();
ChangeNotes notes = newNotes(c);
ImmutableListMultimap<ObjectId, HumanComment> comments = notes.getHumanComments();
assertThat(comments).hasSize(1);
assertThat(comments.entries().asList().get(0).getValue().tag).isEqualTo(tag);
}
Aggregations