Search in sources :

Example 31 with ChangeMessage

use of com.google.gerrit.entities.ChangeMessage in project gerrit by GerritCodeReview.

the class ChangeNotesTest method changeMessageWithTemplate.

@Test
public void changeMessageWithTemplate() throws Exception {
    Change c = newChange();
    ChangeUpdate update = newUpdate(c, changeOwner);
    update.putReviewer(changeOwner.getAccount().id(), REVIEWER);
    String messageTemplate = String.format("Change update by %s, also includes %s", AccountTemplateUtil.getAccountTemplate(changeOwner.getAccountId()), AccountTemplateUtil.getAccountTemplate(otherUser.getAccountId()));
    update.setChangeMessage(messageTemplate);
    update.commit();
    ChangeNotes notes = newNotes(c);
    ChangeMessage cm = Iterables.getOnlyElement(notes.getChangeMessages());
    assertThat(cm.getMessage()).isEqualTo(messageTemplate);
}
Also used : ChangeMessage(com.google.gerrit.entities.ChangeMessage) Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Aggregations

ChangeMessage (com.google.gerrit.entities.ChangeMessage)31 Test (org.junit.Test)23 Change (com.google.gerrit.entities.Change)13 PatchSetApproval (com.google.gerrit.entities.PatchSetApproval)6 List (java.util.List)5 Account (com.google.gerrit.entities.Account)4 LabelId (com.google.gerrit.entities.LabelId)4 Entities (com.google.gerrit.proto.Entities)4 CurrentUser (com.google.gerrit.server.CurrentUser)4 Inject (com.google.inject.Inject)4 ImmutableList (com.google.common.collect.ImmutableList)3 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)3 AttentionSetUpdate (com.google.gerrit.entities.AttentionSetUpdate)3 Operation (com.google.gerrit.entities.AttentionSetUpdate.Operation)3 CODE_REVIEW (com.google.gerrit.entities.LabelId.CODE_REVIEW)3 VERIFIED (com.google.gerrit.entities.LabelId.VERIFIED)3 RefNames (com.google.gerrit.entities.RefNames)3 SubmitRecord (com.google.gerrit.entities.SubmitRecord)3