use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method draftCommentIsCreatedWithSpecifiedCreationTime.
@Test
public void draftCommentIsCreatedWithSpecifiedCreationTime() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
// Don't use nanos. NoteDb supports only second precision.
Instant creationTime = LocalDateTime.of(2020, Month.SEPTEMBER, 15, 12, 10, 43).atZone(ZoneOffset.UTC).toInstant();
String commentUuid = changeOperations.change(changeId).currentPatchset().newDraftComment().createdOn(creationTime).create();
Timestamp creationTimestamp = Timestamp.from(creationTime);
CommentInfo comment = getDraftCommentFromServer(changeId, commentUuid);
assertThat(comment).updated().isEqualTo(creationTimestamp);
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method lineRobotCommentCanBeCreated.
@Test
public void lineRobotCommentCanBeCreated() 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().newRobotComment().onLine(3).ofFile("file1").create();
CommentInfo comment = getRobotCommentFromServerInCurrentPatchset(changeId, commentUuid);
assertThat(comment).line().isEqualTo(3);
assertThat(comment).range().isNull();
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method robotCommentCanBeCreatedWithEmptyMessage.
@Test
public void robotCommentCanBeCreatedWithEmptyMessage() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
String commentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().noMessage().create();
CommentInfo comment = getRobotCommentFromServerInCurrentPatchset(changeId, commentUuid);
assertThat(comment).message().isNull();
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method tagCanBeAttachedToARobotComment.
@Test
public void tagCanBeAttachedToARobotComment() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
String commentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().tag("my special tag").create();
CommentInfo comment = getRobotCommentFromServerInCurrentPatchset(changeId, commentUuid);
assertThat(comment).tag().isEqualTo("my special tag");
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method draftCommentCanBeCreatedOnAutoMergeCommit.
@Test
public void draftCommentCanBeCreatedOnAutoMergeCommit() 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().newDraftComment().onAutoMergeCommit().create();
CommentInfo comment = getDraftCommentFromServer(changeId, commentUuid);
assertThat(comment).side().isEqualTo(Side.PARENT);
assertThat(comment).parent().isNull();
}
Aggregations