GetPastAssignees: Return past assignees as list

When formatting the past assignees as AccountInfo the ordered
LinkedHashSet that was retrieved from NoteDb was converted into an
unordered Set. Hence the results were returned in an undefined order.
This is the reason why the AssigneeIT#testGetPastAssignees() that
verified the correct order was flaky.

Returning the past assignees as set doesn't make sense since JSON
doesn't have sets and Gson converts it to a list anyway.

Change-Id: Ia78d8872d3e9e32928e7954b694c8f76ccdc8e0b
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-09-28 17:43:07 +02:00
parent 6c0b685cd7
commit cf99c9b773
4 changed files with 11 additions and 10 deletions

View File

@@ -30,7 +30,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Iterator;
import java.util.Set;
import java.util.List;
@NoHttpd
public class AssigneeIT extends AbstractDaemonTest {
@@ -73,7 +73,7 @@ public class AssigneeIT extends AbstractDaemonTest {
PushOneCommit.Result r = createChange();
setAssignee(r, user.email);
setAssignee(r, admin.email);
Set<AccountInfo> assignees = getPastAssignees(r);
List<AccountInfo> assignees = getPastAssignees(r);
assertThat(assignees).hasSize(2);
Iterator<AccountInfo> itr = assignees.iterator();
assertThat(itr.next()._accountId).isEqualTo(user.getId().get());
@@ -107,7 +107,7 @@ public class AssigneeIT extends AbstractDaemonTest {
return gApi.changes().id(r.getChange().getId().get()).getAssignee();
}
private Set<AccountInfo> getPastAssignees(PushOneCommit.Result r)
private List<AccountInfo> getPastAssignees(PushOneCommit.Result r)
throws Exception {
return gApi.changes().id(r.getChange().getId().get()).getPastAssignees();
}