Add tests for ChangeNotesParser parse failures
Change-Id: I895b75bb502c2057aea0eb24c6b43c721efda7b9
This commit is contained in:
@@ -15,9 +15,7 @@
|
||||
package com.google.gerrit.server.notedb;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.gerrit.server.notedb.ChangeNoteUtil.GERRIT_PLACEHOLDER_HOST;
|
||||
|
||||
import com.google.gerrit.common.data.AccountInfo;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
@@ -171,10 +169,8 @@ public abstract class AbstractChangeUpdate extends VersionedMetaData {
|
||||
}
|
||||
|
||||
protected PersonIdent newIdent(Account author, Date when) {
|
||||
return new PersonIdent(
|
||||
new AccountInfo(author).getName(anonymousCowardName),
|
||||
author.getId().get() + "@" + GERRIT_PLACEHOLDER_HOST,
|
||||
when, serverIdent.getTimeZone());
|
||||
return ChangeNoteUtil.newIdent(author, when, serverIdent,
|
||||
anonymousCowardName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -14,11 +14,16 @@
|
||||
|
||||
package com.google.gerrit.server.notedb;
|
||||
|
||||
import com.google.gerrit.common.data.AccountInfo;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.RefNames;
|
||||
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.revwalk.FooterKey;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ChangeNoteUtil {
|
||||
static final String GERRIT_PLACEHOLDER_HOST = "gerrit";
|
||||
|
||||
@@ -43,6 +48,14 @@ public class ChangeNoteUtil {
|
||||
return r.toString();
|
||||
}
|
||||
|
||||
static PersonIdent newIdent(Account author, Date when,
|
||||
PersonIdent serverIdent, String anonymousCowardName) {
|
||||
return new PersonIdent(
|
||||
new AccountInfo(author).getName(anonymousCowardName),
|
||||
author.getId().get() + "@" + GERRIT_PLACEHOLDER_HOST,
|
||||
when, serverIdent.getTimeZone());
|
||||
}
|
||||
|
||||
private ChangeNoteUtil() {
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user