Search in sources :

Example 61 with HumanComment

use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.

the class CommentThreadTest method threadCanBeUnresolved.

@Test
public void threadCanBeUnresolved() {
    HumanComment root = unresolved(createComment("root"));
    CommentThread<Comment> commentThread = CommentThread.builder().addComment(root).build();
    assertThat(commentThread.unresolved()).isTrue();
}
Also used : Comment(com.google.gerrit.entities.Comment) HumanComment(com.google.gerrit.entities.HumanComment) HumanComment(com.google.gerrit.entities.HumanComment) Test(org.junit.Test)

Example 62 with HumanComment

use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.

the class CommentThreadTest method threadCanBeResolved.

@Test
public void threadCanBeResolved() {
    HumanComment root = resolved(createComment("root"));
    CommentThread<Comment> commentThread = CommentThread.builder().addComment(root).build();
    assertThat(commentThread.unresolved()).isFalse();
}
Also used : Comment(com.google.gerrit.entities.Comment) HumanComment(com.google.gerrit.entities.HumanComment) HumanComment(com.google.gerrit.entities.HumanComment) Test(org.junit.Test)

Example 63 with HumanComment

use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.

the class CommentThreadTest method lastCommentInThreadDeterminesUnresolvedStatus.

@Test
public void lastCommentInThreadDeterminesUnresolvedStatus() {
    HumanComment root = resolved(createComment("root"));
    HumanComment child = unresolved(createComment("child"));
    CommentThread<Comment> commentThread = CommentThread.builder().addComment(root).addComment(child).build();
    assertThat(commentThread.unresolved()).isTrue();
}
Also used : Comment(com.google.gerrit.entities.Comment) HumanComment(com.google.gerrit.entities.HumanComment) HumanComment(com.google.gerrit.entities.HumanComment) Test(org.junit.Test)

Example 64 with HumanComment

use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.

the class CommentThreadsTest method threadsConsiderParentRelationshipStrongerThanDate.

@Test
public void threadsConsiderParentRelationshipStrongerThanDate() {
    HumanComment root = writtenOn(createComment("root"), Instant.ofEpochMilli(3));
    HumanComment child1 = writtenOn(asReply(createComment("child1"), "root"), Instant.ofEpochMilli(2));
    HumanComment child2 = writtenOn(asReply(createComment("child2"), "child1"), Instant.ofEpochMilli(1));
    ImmutableList<HumanComment> comments = ImmutableList.of(child2, child1, root);
    ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreads();
    ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(root, child1, child2));
    assertThat(commentThreads).isEqualTo(expectedThreads);
}
Also used : HumanComment(com.google.gerrit.entities.HumanComment) Test(org.junit.Test)

Example 65 with HumanComment

use of com.google.gerrit.entities.HumanComment in project gerrit by GerritCodeReview.

the class CommentThreadsTest method threadsFallBackToUuidOrderIfParentAndDateAreTheSame.

@Test
public void threadsFallBackToUuidOrderIfParentAndDateAreTheSame() {
    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(2));
    ImmutableList<HumanComment> comments = ImmutableList.of(sibling2, sibling1, root);
    ImmutableSet<CommentThread<HumanComment>> commentThreads = CommentThreads.forComments(comments).getThreads();
    ImmutableSet<CommentThread<HumanComment>> expectedThreads = ImmutableSet.of(toThread(root, sibling1, sibling2));
    assertThat(commentThreads).isEqualTo(expectedThreads);
}
Also used : HumanComment(com.google.gerrit.entities.HumanComment) Test(org.junit.Test)

Aggregations

HumanComment (com.google.gerrit.entities.HumanComment)87 Test (org.junit.Test)53 Change (com.google.gerrit.entities.Change)39 PatchSet (com.google.gerrit.entities.PatchSet)39 ObjectId (org.eclipse.jgit.lib.ObjectId)39 CommentRange (com.google.gerrit.entities.CommentRange)25 Instant (java.time.Instant)20 ChangeNotes (com.google.gerrit.server.notedb.ChangeNotes)14 Comment (com.google.gerrit.entities.Comment)11 Project (com.google.gerrit.entities.Project)11 Map (java.util.Map)11 ArrayList (java.util.ArrayList)8 RevCommit (org.eclipse.jgit.revwalk.RevCommit)8 HashMap (java.util.HashMap)7 NoteMap (org.eclipse.jgit.notes.NoteMap)7 ImmutableMap (com.google.common.collect.ImmutableMap)6 TraceTimer (com.google.gerrit.server.logging.TraceContext.TraceTimer)6 FluentLogger (com.google.common.flogger.FluentLogger)5 Account (com.google.gerrit.entities.Account)5 BranchNameKey (com.google.gerrit.entities.BranchNameKey)5