ConflictKey: Add tests for order normalizing behavior

Add a create method, to make eventual conversion to AutoValue easier to
review. Don't attempt to rewrite the logic at all, as this test is
intended to codify the current behavior.

While we're there, split off a small test target for the change
query tests.

Change-Id: Iec78e15c508d7f79ec10451f3d0331330bacb502
This commit is contained in:
Dave Borowitz
2018-05-18 09:35:54 -04:00
parent 9941e0d46e
commit a174300a84
3 changed files with 77 additions and 4 deletions

View File

@@ -17,11 +17,17 @@ package com.google.gerrit.server.query.change;
import com.google.gerrit.extensions.client.SubmitType;
import java.io.Serializable;
import java.util.Objects;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectId;
public class ConflictKey implements Serializable {
private static final long serialVersionUID = 2L;
public static ConflictKey create(
AnyObjectId commit, AnyObjectId otherCommit, SubmitType submitType, boolean contentMerge) {
return new ConflictKey(commit.copy(), otherCommit.copy(), submitType, contentMerge);
}
private final ObjectId commit;
private final ObjectId otherCommit;
private final SubmitType submitType;