Search in sources :

Example 1 with TestHumanComment

use of com.google.gerrit.acceptance.testsuite.change.TestHumanComment in project gerrit by GerritCodeReview.

the class CommentsIT method putDraft_humanInReplyTo.

@Test
public void putDraft_humanInReplyTo() throws Exception {
    Change.Id changeId = changeOperations.newChange().create();
    String parentCommentUuid = changeOperations.change(changeId).currentPatchset().newComment().create();
    DraftInput draft = CommentsUtil.newDraft(COMMIT_MSG, Side.REVISION, 0, "foo");
    draft.inReplyTo = parentCommentUuid;
    String createdDraftUuid = addDraft(changeId, draft).id;
    TestHumanComment actual = changeOperations.change(changeId).draftComment(createdDraftUuid).get();
    assertThat(actual.parentUuid()).hasValue(parentCommentUuid);
}
Also used : TestHumanComment(com.google.gerrit.acceptance.testsuite.change.TestHumanComment) DraftInput(com.google.gerrit.extensions.api.changes.DraftInput) Change(com.google.gerrit.entities.Change) IdString(com.google.gerrit.extensions.restapi.IdString) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 2 with TestHumanComment

use of com.google.gerrit.acceptance.testsuite.change.TestHumanComment in project gerrit by GerritCodeReview.

the class CommentsIT method updatedDraftStillPointsToParentComment.

@Test
public void updatedDraftStillPointsToParentComment() throws Exception {
    Account.Id accountId = accountOperations.newAccount().create();
    Change.Id changeId = changeOperations.newChange().create();
    PatchSet.Id patchsetId = changeOperations.change(changeId).currentPatchset().get().patchsetId();
    String parentCommentUuid = changeOperations.change(changeId).patchset(patchsetId).newComment().create();
    String draftCommentUuid = changeOperations.change(changeId).patchset(patchsetId).newDraftComment().parentUuid(parentCommentUuid).author(accountId).create();
    // Each user can only see their own drafts.
    requestScopeOperations.setApiUser(accountId);
    DraftInput draftInput = CommentsUtil.newDraft(FILE_NAME, Side.REVISION, 0, "bar");
    draftInput.message = "Another comment text.";
    gApi.changes().id(changeId.get()).revision(patchsetId.get()).draft(draftCommentUuid).update(draftInput);
    TestHumanComment comment = changeOperations.change(changeId).draftComment(draftCommentUuid).get();
    assertThat(comment.parentUuid()).hasValue(parentCommentUuid);
}
Also used : Account(com.google.gerrit.entities.Account) TestHumanComment(com.google.gerrit.acceptance.testsuite.change.TestHumanComment) PatchSet(com.google.gerrit.entities.PatchSet) DraftInput(com.google.gerrit.extensions.api.changes.DraftInput) Change(com.google.gerrit.entities.Change) IdString(com.google.gerrit.extensions.restapi.IdString) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 3 with TestHumanComment

use of com.google.gerrit.acceptance.testsuite.change.TestHumanComment in project gerrit by GerritCodeReview.

the class CommentsIT method putDraft_robotInReplyTo.

@Test
public void putDraft_robotInReplyTo() throws Exception {
    Change.Id changeId = changeOperations.newChange().create();
    String parentRobotCommentUuid = changeOperations.change(changeId).currentPatchset().newRobotComment().create();
    DraftInput draft = CommentsUtil.newDraft(COMMIT_MSG, Side.REVISION, 0, "foo");
    draft.inReplyTo = parentRobotCommentUuid;
    String createdDraftUuid = addDraft(changeId, draft).id;
    TestHumanComment actual = changeOperations.change(changeId).draftComment(createdDraftUuid).get();
    assertThat(actual.parentUuid()).hasValue(parentRobotCommentUuid);
}
Also used : TestHumanComment(com.google.gerrit.acceptance.testsuite.change.TestHumanComment) DraftInput(com.google.gerrit.extensions.api.changes.DraftInput) Change(com.google.gerrit.entities.Change) IdString(com.google.gerrit.extensions.restapi.IdString) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)3 TestHumanComment (com.google.gerrit.acceptance.testsuite.change.TestHumanComment)3 Change (com.google.gerrit.entities.Change)3 DraftInput (com.google.gerrit.extensions.api.changes.DraftInput)3 IdString (com.google.gerrit.extensions.restapi.IdString)3 Test (org.junit.Test)3 Account (com.google.gerrit.entities.Account)1 PatchSet (com.google.gerrit.entities.PatchSet)1