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
This commit is contained in:
David Pursehouse 2018-08-03 11:11:15 +01:00
parent 8be8301520
commit 27ba8e19b5
2 changed files with 8 additions and 4 deletions

View File

@ -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<RefUpdatedEvent> events =

View File

@ -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