use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method commentCanBeCreatedOnOlderPatchset.
@Test
public void commentCanBeCreatedOnOlderPatchset() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
PatchSet.Id previousPatchsetId = changeOperations.change(changeId).currentPatchset().get().patchsetId();
changeOperations.change(changeId).newPatchset().create();
String commentUuid = changeOperations.change(changeId).patchset(previousPatchsetId).newComment().create();
CommentInfo comment = getCommentFromServer(changeId, commentUuid);
assertThat(comment).patchSet().isEqualTo(previousPatchsetId.get());
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method commentCanBeCreatedOnAutoMergeCommit.
@Test
public void commentCanBeCreatedOnAutoMergeCommit() 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().onAutoMergeCommit().create();
CommentInfo comment = getCommentFromServer(changeId, commentUuid);
assertThat(comment).side().isEqualTo(Side.PARENT);
assertThat(comment).parent().isNull();
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method draftCommentCanBeCreatedAsUnresolved.
@Test
public void draftCommentCanBeCreatedAsUnresolved() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
String commentUuid = changeOperations.change(changeId).currentPatchset().newDraftComment().unresolved().create();
CommentInfo comment = getDraftCommentFromServer(changeId, commentUuid);
assertThat(comment).unresolved().isTrue();
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method zoneOfCreationDateCanBeOmitted.
@Test
public void zoneOfCreationDateCanBeOmitted() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
// As we don't care about the exact time zone internally used as a default, do a relative test
// so that we don't need to assert on exact instants in time. For a relative test, we need two
// comments whose creation date should be exactly the specified amount apart.
// Don't use nanos or millis. NoteDb supports only second precision.
LocalDateTime creationTime1 = LocalDateTime.of(2020, Month.SEPTEMBER, 15, 12, 10, 43);
LocalDateTime creationTime2 = creationTime1.plusMinutes(10);
String commentUuid1 = changeOperations.change(changeId).currentPatchset().newComment().createdOn(creationTime1).create();
String commentUuid2 = changeOperations.change(changeId).currentPatchset().newComment().createdOn(creationTime2).create();
CommentInfo comment1 = getCommentFromServer(changeId, commentUuid1);
Instant comment1Creation = comment1.updated.toInstant();
CommentInfo comment2 = getCommentFromServer(changeId, commentUuid2);
Instant comment2Creation = comment2.updated.toInstant();
Duration commentCreationDifference = Duration.between(comment1Creation, comment2Creation);
assertThat(commentCreationDifference).isEqualTo(Duration.ofMinutes(10));
}
use of com.google.gerrit.extensions.common.CommentInfo in project gerrit by GerritCodeReview.
the class PatchsetOperationsImplTest method commentIsCreatedWithSpecifiedAuthor.
@Test
public void commentIsCreatedWithSpecifiedAuthor() throws Exception {
Change.Id changeId = changeOperations.newChange().create();
Account.Id accountId = accountOperations.newAccount().create();
String commentUuid = changeOperations.change(changeId).currentPatchset().newComment().author(accountId).create();
CommentInfo comment = getCommentFromServer(changeId, commentUuid);
assertThat(comment).author().id().isEqualTo(accountId.get());
}
Aggregations