Search in sources :

Example 1 with AssigneeStatusUpdate

use of com.google.gerrit.server.AssigneeStatusUpdate in project gerrit by GerritCodeReview.

the class ChangeNotesTest method assigneeStatusUpdateChangeNotes.

@Test
public void assigneeStatusUpdateChangeNotes() throws Exception {
    Change c = newChange();
    ChangeUpdate update = newUpdate(c, otherUser);
    update.setAssignee(otherUserId);
    update.commit();
    update = newUpdate(c, changeOwner);
    update.removeAssignee();
    update.commit();
    update = newUpdate(c, changeOwner);
    update.setAssignee(changeOwner.getAccountId());
    update.commit();
    update = newUpdate(c, changeOwner);
    update.setAssignee(otherUserId);
    update.commit();
    ChangeNotes notes = newNotes(c);
    ImmutableList<AssigneeStatusUpdate> statusUpdates = notes.getAssigneeUpdates();
    assertThat(statusUpdates).hasSize(4);
    assertThat(statusUpdates.get(3).updatedBy()).isEqualTo(otherUserId);
    assertThat(statusUpdates.get(3).currentAssignee()).hasValue(otherUserId);
    assertThat(statusUpdates.get(2).currentAssignee()).isEmpty();
    assertThat(statusUpdates.get(1).currentAssignee()).hasValue(changeOwner.getAccountId());
    assertThat(statusUpdates.get(0).currentAssignee()).hasValue(otherUserId);
}
Also used : AssigneeStatusUpdate(com.google.gerrit.server.AssigneeStatusUpdate) Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Aggregations

Change (com.google.gerrit.entities.Change)1 AssigneeStatusUpdate (com.google.gerrit.server.AssigneeStatusUpdate)1 Test (org.junit.Test)1