public void testCleanUpGerritCausesThreeInstances() throws Exception {
AbstractBuild build = mockBuild("projectX", 2);
PatchsetCreated event = Setup.createPatchsetCreated();
GerritCause cause = new GerritCause(event, true);
when(build.getCause(GerritCause.class)).thenReturn(cause);
CauseAction causeAction = mock(CauseAction.class);
List<Cause> causes = new LinkedList<Cause>();
causes.add(cause);
causes.add(new GerritCause(event, true));
causes.add(new GerritCause(event, true));
when(causeAction.getCauses()).thenReturn(causes);
when(build.getAction(CauseAction.class)).thenReturn(causeAction);
ToGerritRunListener toGerritRunListener = new ToGerritRunListener();
toGerritRunListener.cleanUpGerritCauses(cause, build);