From 27ba8e19b533b4f8aac811e6457dcffefe0352a8 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 3 Aug 2018 11:11:15 +0100 Subject: [PATCH] EventRecorder: Add assertNoRefUpdatedEvents helper method It's clearer to call assertNoRefUpdatedEvents than assertRefUpdatedEvents with an explicit empty array. Update ProjectIT to use it. Change-Id: I9142ee36782f5f04e265cd9482bb9e399c24d6fe --- .../java/com/google/gerrit/acceptance/EventRecorder.java | 4 ++++ .../google/gerrit/acceptance/api/project/ProjectIT.java | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/EventRecorder.java b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/EventRecorder.java index f25ca83220..7348c8991b 100644 --- a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/EventRecorder.java +++ b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/EventRecorder.java @@ -138,6 +138,10 @@ public class EventRecorder { return events; } + public void assertNoRefUpdatedEvents(String project, String branch) throws Exception { + getRefUpdatedEvents(project, branch, 0); + } + public void assertRefUpdatedEvents(String project, String branch, String... expected) throws Exception { ImmutableList events = diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java index 72e79d327b..4ca2f01e27 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java @@ -41,9 +41,9 @@ public class ProjectIT extends AbstractDaemonTest { assertThat(name).isEqualTo(gApi.projects().create(name).get().name); RevCommit head = getRemoteHead(name, RefNames.REFS_CONFIG); - eventRecorder.assertRefUpdatedEvents(name, RefNames.REFS_CONFIG, null, head); - eventRecorder.assertRefUpdatedEvents(name, "refs/heads/master", new String[] {}); + eventRecorder.assertRefUpdatedEvents(name, RefNames.REFS_CONFIG, null, head); + eventRecorder.assertNoRefUpdatedEvents(name, "refs/heads/master"); } @Test @@ -52,9 +52,9 @@ public class ProjectIT extends AbstractDaemonTest { assertThat(name).isEqualTo(gApi.projects().create(name + ".git").get().name); RevCommit head = getRemoteHead(name, RefNames.REFS_CONFIG); - eventRecorder.assertRefUpdatedEvents(name, RefNames.REFS_CONFIG, null, head); - eventRecorder.assertRefUpdatedEvents(name, "refs/heads/master", new String[] {}); + eventRecorder.assertRefUpdatedEvents(name, RefNames.REFS_CONFIG, null, head); + eventRecorder.assertNoRefUpdatedEvents(name, "refs/heads/master"); } @Test