Search in sources :

Example 51 with CommentInfo

use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.

the class PatchsetOperationsImplTest method replyToRobotCommentCanBeCreated.

@Test
public void replyToRobotCommentCanBeCreated() throws Exception {
    Change.Id changeId = changeOperations.newChange().create();
    String parentCommentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().create();
    String commentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().parentUuid(parentCommentUuid).create();
    CommentInfo comment = getRobotCommentFromServerInCurrentPatchset(changeId, commentUuid);
    assertThat(comment).inReplyTo().isEqualTo(parentCommentUuid);
}
Also used : Change(com.google.gerrit.entities.Change) CommentInfo(com.google.gerrit.extensions.common.CommentInfo) RobotCommentInfo(com.google.gerrit.extensions.common.RobotCommentInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 52 with CommentInfo

use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.

the class PatchsetOperationsImplTest method lineCommentCanBeCreated.

@Test
public void lineCommentCanBeCreated() throws Exception {
    Change.Id changeId = changeOperations.newChange().file("file1").content("Line 1\nLine 2\nLine 3\nLine 4\n").create();
    String commentUuid = changeOperations.change(changeId).currentPatchset().newComment().onLine(3).ofFile("file1").create();
    CommentInfo comment = getCommentFromServer(changeId, commentUuid);
    assertThat(comment).line().isEqualTo(3);
    assertThat(comment).range().isNull();
}
Also used : Change(com.google.gerrit.entities.Change) CommentInfo(com.google.gerrit.extensions.common.CommentInfo) RobotCommentInfo(com.google.gerrit.extensions.common.RobotCommentInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 53 with CommentInfo

use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.

the class PatchsetOperationsImplTest method draftFileCommentCanBeCreated.

@Test
public void draftFileCommentCanBeCreated() throws Exception {
    Change.Id changeId = changeOperations.newChange().file("file1").content("Line 1").create();
    String commentUuid = changeOperations.change(changeId).currentPatchset().newDraftComment().onFileLevelOf("file1").create();
    CommentInfo comment = getDraftCommentFromServer(changeId, commentUuid);
    assertThat(comment).path().isEqualTo("file1");
    assertThat(comment).line().isNull();
    assertThat(comment).range().isNull();
}
Also used : Change(com.google.gerrit.entities.Change) CommentInfo(com.google.gerrit.extensions.common.CommentInfo) RobotCommentInfo(com.google.gerrit.extensions.common.RobotCommentInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 54 with CommentInfo

use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.

the class PatchsetOperationsImplTest method commentCanBeCreatedOnSecondParentCommit.

@Test
public void commentCanBeCreatedOnSecondParentCommit() throws Exception {
    Change.Id parent1ChangeId = changeOperations.newChange().create();
    Change.Id parent2ChangeId = changeOperations.newChange().create();
    Change.Id changeId = changeOperations.newChange().mergeOf().change(parent1ChangeId).and().change(parent2ChangeId).create();
    String commentUuid = changeOperations.change(changeId).currentPatchset().newComment().onSecondParentCommit().create();
    CommentInfo comment = getCommentFromServer(changeId, commentUuid);
    assertThat(comment).side().isEqualTo(Side.PARENT);
    assertThat(comment).parent().isEqualTo(2);
}
Also used : Change(com.google.gerrit.entities.Change) CommentInfo(com.google.gerrit.extensions.common.CommentInfo) RobotCommentInfo(com.google.gerrit.extensions.common.RobotCommentInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 55 with CommentInfo

use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.

the class PatchsetOperationsImplTest method commentCanBeCreatedAsResolved.

@Test
public void commentCanBeCreatedAsResolved() throws Exception {
    Change.Id changeId = changeOperations.newChange().create();
    String commentUuid = changeOperations.change(changeId).currentPatchset().newComment().resolved().create();
    CommentInfo comment = getCommentFromServer(changeId, commentUuid);
    assertThat(comment).unresolved().isFalse();
}
Also used : Change(com.google.gerrit.entities.Change) CommentInfo(com.google.gerrit.extensions.common.CommentInfo) RobotCommentInfo(com.google.gerrit.extensions.common.RobotCommentInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Aggregations

CommentInfo (com.google.gerrit.extensions.common.CommentInfo)186 Test (org.junit.Test)178 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)164 Change (com.google.gerrit.entities.Change)120 PatchSet (com.google.gerrit.entities.PatchSet)62 RobotCommentInfo (com.google.gerrit.extensions.common.RobotCommentInfo)56 List (java.util.List)51 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)47 ImmutableList (com.google.common.collect.ImmutableList)46 IdString (com.google.gerrit.extensions.restapi.IdString)34 CommentInput (com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput)27 ArrayList (java.util.ArrayList)26 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)25 Collectors.toList (java.util.stream.Collectors.toList)25 DraftInput (com.google.gerrit.extensions.api.changes.DraftInput)24 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)22 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)21 DeleteCommentInput (com.google.gerrit.extensions.api.changes.DeleteCommentInput)20 CommentInfoSubject.assertThatList (com.google.gerrit.extensions.common.testing.CommentInfoSubject.assertThatList)19 MailMessage (com.google.gerrit.mail.MailMessage)13