TestChanges: Pass only Account.Id to newChange

Only the account ID is used, so we don't need a whole IdentifiedUser.
There are only a few callers.

Change-Id: If2eca8769441dc2d24149213fd2a149854aaea93
This commit is contained in:
Dave Borowitz
2014-11-20 12:15:41 -08:00
committed by David Pursehouse
parent 021424405a
commit d1ff2e36d0
4 changed files with 9 additions and 8 deletions

View File

@@ -303,7 +303,7 @@ public class CommentsTest {
}
private Change newChange() {
return TestChanges.newChange(project, changeOwner);
return TestChanges.newChange(project, changeOwner.getAccountId());
}
private ChangeUpdate newUpdate(Change c, final IdentifiedUser user) throws Exception {

View File

@@ -170,7 +170,7 @@ public class AbstractChangeNotesTest {
}
protected Change newChange() {
return TestChanges.newChange(project, changeOwner);
return TestChanges.newChange(project, changeOwner.getAccountId());
}
protected ChangeUpdate newUpdate(Change c, IdentifiedUser user)

View File

@@ -36,7 +36,7 @@ import java.util.TimeZone;
public class CommitMessageOutputTest extends AbstractChangeNotesTest {
@Test
public void approvalsCommitFormatSimple() throws Exception {
Change c = TestChanges.newChange(project, changeOwner, 1);
Change c = TestChanges.newChange(project, changeOwner.getAccountId(), 1);
ChangeUpdate update = newUpdate(c, changeOwner);
update.putApproval("Verified", (short) 1);
update.putApproval("Code-Review", (short) -1);
@@ -71,7 +71,7 @@ public class CommitMessageOutputTest extends AbstractChangeNotesTest {
@Test
public void changeMessageCommitFormatSimple() throws Exception {
Change c = TestChanges.newChange(project, changeOwner, 1);
Change c = TestChanges.newChange(project, changeOwner.getAccountId(), 1);
ChangeUpdate update = newUpdate(c, changeOwner);
update.setChangeMessage("Just a little code change.\n"
+ "How about a new line");

View File

@@ -18,6 +18,7 @@ import static org.easymock.EasyMock.expect;
import com.google.common.collect.Ordering;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
@@ -47,17 +48,17 @@ import java.util.concurrent.atomic.AtomicInteger;
public class TestChanges {
private static final AtomicInteger nextChangeId = new AtomicInteger(1);
public static Change newChange(Project.NameKey project, IdentifiedUser user) {
return newChange(project, user, nextChangeId.getAndIncrement());
public static Change newChange(Project.NameKey project, Account.Id userId) {
return newChange(project, userId, nextChangeId.getAndIncrement());
}
public static Change newChange(Project.NameKey project, IdentifiedUser user,
public static Change newChange(Project.NameKey project, Account.Id userId,
int id) {
Change.Id changeId = new Change.Id(id);
Change c = new Change(
new Change.Key("Iabcd1234abcd1234abcd1234abcd1234abcd1234"),
changeId,
user.getAccount().getId(),
userId,
new Branch.NameKey(project, "master"),
TimeUtil.nowTs());
incrementPatchSet(c);