diff options
author | David Pursehouse <dpursehouse@collab.net> | 2016-05-27 10:01:06 +0900 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2016-05-27 10:09:19 +0900 |
commit | 4a127f395ef33db92234ee86387c1cfed780d5cc (patch) | |
tree | aa987e83704ba2ef77c7b600dc98e30d61005fd7 | |
parent | 534cde9323c0bfc1d3638a1c356bfb5dba21ca8f (diff) |
AbstractSubmit: Add stricter assertions about ref-updated event content
Instead of storing only the value of the new ref, store the entire ref
update object that contains both the old ref and new ref values.
Add assertions to verify that both the old ref and new ref values are
set, and that they differ.
Change-Id: I72945a837103ecbadcbaae6795ce3c40bd45a9a6
-rw-r--r-- | gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java index b9fb3937f7..25af0e1933 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java @@ -86,7 +86,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest { } private Map<String, String> mergeResults; - private Map<String, String> refUpdatedEvents; + private Map<String, RefUpdateAttribute> refUpdatedEvents; @Inject private ChangeNotes.Factory notesFactory; @@ -116,7 +116,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest { } else if (event instanceof RefUpdatedEvent) { RefUpdatedEvent e = (RefUpdatedEvent) event; RefUpdateAttribute r = e.refUpdate; - refUpdatedEvents.put(r.project + "-" + r.refName, r.newRev); + refUpdatedEvents.put(r.project + "-" + r.refName, r); } } @@ -252,9 +252,13 @@ public abstract class AbstractSubmit extends AbstractDaemonTest { String newRev = mergeResults.get(Integer.toString(change._number)); assertThat(newRev).isNotNull(); assertThat(branch.revision).isEqualTo(newRev); - newRev = refUpdatedEvents.get(change.project + "-" + branch.ref); - assertThat(newRev).isNotNull(); - assertThat(branch.revision).isEqualTo(newRev); + RefUpdateAttribute refUpdate = + refUpdatedEvents.get(change.project + "-" + branch.ref); + assertThat(refUpdate).isNotNull(); + assertThat(refUpdate.newRev).isNotNull(); + assertThat(refUpdate.oldRev).isNotNull(); + assertThat(refUpdate.newRev).isNotEqualTo(refUpdate.oldRev); + assertThat(branch.revision).isEqualTo(refUpdate.newRev); } b.consume(); } |