ReplicationIT: fix flakiness of shouldReplicateNewBranch

shouldReplicateNewBranch() should compare the target branch with
the source SHA1 and not with the target.

Comparing two SHA1 on the target repository is flaky because
the two replication events may come at different times.

Change-Id: Icfc4da705bc07805e881faea517984fb2c9abe09
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java
index 1bb0bbf..471d729 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java
@@ -143,11 +143,12 @@
 
     assertThat(listReplicationTasks("refs/heads/(mybranch|master)")).hasSize(2);
 
-    try (Repository repo = repoManager.openRepository(targetProject)) {
+    try (Repository repo = repoManager.openRepository(targetProject);
+        Repository sourceRepo = repoManager.openRepository(project)) {
       waitUntil(() -> checkedGetRef(repo, newBranch) != null);
 
+      Ref masterRef = getRef(sourceRepo, master);
       Ref targetBranchRef = getRef(repo, newBranch);
-      Ref masterRef = getRef(repo, master);
       assertThat(targetBranchRef).isNotNull();
       assertThat(targetBranchRef.getObjectId()).isEqualTo(masterRef.getObjectId());
     }