Search in sources :

Example 6 with AttentionSetInfo

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

the class AttentionSetIT method reviewWithManuallyAddedUserAndTemplateReason.

@Test
public void reviewWithManuallyAddedUserAndTemplateReason() throws Exception {
    PushOneCommit.Result r = createChange();
    requestScopeOperations.setApiUser(user.id());
    String manualReason = "Review by " + AccountTemplateUtil.getAccountTemplate(user.id());
    ReviewInput reviewInput = ReviewInput.create().addUserToAttentionSet(user.email(), manualReason);
    change(r).current().review(reviewInput);
    AttentionSetInfo attentionSetInfo = change(r).get().attentionSet.get(user.id().get());
    assertThat(attentionSetInfo.reason).isEqualTo(manualReason);
    assertThat(attentionSetInfo.reasonAccount).isEqualTo(getAccountInfo(user.id()));
    assertThat(attentionSetInfo.account).isEqualTo(getAccountInfo(user.id()));
}
Also used : ReviewInput(com.google.gerrit.extensions.api.changes.ReviewInput) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AttentionSetInfo(com.google.gerrit.extensions.common.AttentionSetInfo) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

AttentionSetInfo (com.google.gerrit.extensions.common.AttentionSetInfo)6 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)4 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)4 Test (org.junit.Test)4 AttentionSetUpdate (com.google.gerrit.entities.AttentionSetUpdate)3 AttentionSetInput (com.google.gerrit.extensions.api.changes.AttentionSetInput)3 ImmutableSet (com.google.common.collect.ImmutableSet)1 ImmutableSet.toImmutableSet (com.google.common.collect.ImmutableSet.toImmutableSet)1 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)1 AccountInfo (com.google.gerrit.extensions.common.AccountInfo)1 Response (com.google.gerrit.extensions.restapi.Response)1 RestReadView (com.google.gerrit.extensions.restapi.RestReadView)1 AccountLoader (com.google.gerrit.server.account.AccountLoader)1 ChangeResource (com.google.gerrit.server.change.ChangeResource)1 PermissionBackendException (com.google.gerrit.server.permissions.PermissionBackendException)1 AttentionSetUtil (com.google.gerrit.server.util.AttentionSetUtil)1 AttentionSetUtil.additionsOnly (com.google.gerrit.server.util.AttentionSetUtil.additionsOnly)1 Inject (com.google.inject.Inject)1 Singleton (com.google.inject.Singleton)1 Set (java.util.Set)1