use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method completeThreadWithBranchesCanBeRequestedByReplyToIntermediateComment.
@Test
public void completeThreadWithBranchesCanBeRequestedByReplyToIntermediateComment() {
HumanComment root = writtenOn(createComment("root"), Instant.ofEpochMilli(1));
HumanComment sibling1 = writtenOn(asReply(createComment("sibling1"), "root"), Instant.ofEpochMilli(2));
HumanComment sibling2 = writtenOn(asReply(createComment("sibling2"), "root"), Instant.ofEpochMilli(3));
HumanComment sibling1Child = writtenOn(asReply(createComment("sibling1Child"), "sibling1"), Instant.ofEpochMilli(4));
HumanComment sibling2Child = writtenOn(asReply(createComment("sibling2Child"), "sibling2"), Instant.ofEpochMilli(5));
HumanComment reply = asReply(createComment("sibling1"), "root");
ImmutableList<HumanComment> comments = ImmutableList.of(root, sibling1, sibling2, sibling1Child, sibling2Child);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreadsForChildren(ImmutableList.of(reply));
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(root, sibling1, sibling2, sibling1Child, sibling2Child));
assertThat(commentThreads).isEqualTo(expectedThreads);
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method specificThreadsCanBeRequestedByTheirReply.
@Test
public void specificThreadsCanBeRequestedByTheirReply() {
HumanComment thread1Root = createComment("thread1Root");
HumanComment thread2Root = createComment("thread2Root");
HumanComment thread1Reply = asReply(createComment("thread1Reply"), "thread1Root");
ImmutableList<HumanComment> comments = ImmutableList.of(thread1Root, thread2Root, thread1Reply);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreadsForChildren(ImmutableList.of(thread1Reply));
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(thread1Root, thread1Reply));
assertThat(commentThreads).isEqualTo(expectedThreads);
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method threadsCanBeCreatedFromSingleRoot.
@Test
public void threadsCanBeCreatedFromSingleRoot() {
HumanComment root = createComment("root");
ImmutableList<HumanComment> comments = ImmutableList.of(root);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreads();
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(root));
assertThat(commentThreads).isEqualTo(expectedThreads);
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method childWithNotAvailableParentIsAssumedToBeRoot.
@Test
public void childWithNotAvailableParentIsAssumedToBeRoot() {
HumanComment child1 = asReply(createComment("child1"), "root");
ImmutableList<HumanComment> comments = ImmutableList.of(child1);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreads();
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(child1));
assertThat(commentThreads).isEqualTo(expectedThreads);
}
use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.
the class CommentThreadsTest method branchedThreadsAreFlattenedAccordingToDate.
@Test
public void branchedThreadsAreFlattenedAccordingToDate() {
HumanComment root = writtenOn(createComment("root"), Instant.ofEpochMilli(1));
HumanComment sibling1 = writtenOn(asReply(createComment("sibling1"), "root"), Instant.ofEpochMilli(2));
HumanComment sibling2 = writtenOn(asReply(createComment("sibling2"), "root"), Instant.ofEpochMilli(3));
HumanComment sibling1Child = writtenOn(asReply(createComment("sibling1Child"), "sibling1"), Instant.ofEpochMilli(4));
HumanComment sibling2Child = writtenOn(asReply(createComment("sibling2Child"), "sibling2"), Instant.ofEpochMilli(5));
ImmutableList<HumanComment> comments = ImmutableList.of(sibling2, sibling2Child, sibling1, sibling1Child, root);
ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreads();
ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(root, sibling1, sibling2, sibling1Child, sibling2Child));
assertThat(commentThreads).isEqualTo(expectedThreads);
}
Aggregations