GerritHandler handler = mock(GerritHandler.class);
when(plugin.getHandler()).thenReturn(handler);
GerritTrigger trigger = Setup.createDefaultTrigger(project);
when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);
PatchsetCreated event = Setup.createPatchsetCreated();
GerritCause gerritCause = new GerritCause(event, true);
gerritCause = spy(gerritCause);
doReturn("http://mock.url").when(gerritCause).getUrl();
IGerritHudsonTriggerConfig config = Setup.createConfig();
config = spy(config);
doReturn("http://mock.url").when(config).getGerritFrontEndUrlFor(any(GerritTriggeredEvent.class));
when(server.getConfig()).thenReturn(config);
trigger.schedule(gerritCause, event);
verify(project).scheduleBuild2(
anyInt(),
same(gerritCause),
isA(Action.class),
isA(Action.class),
isA(Action.class),
isParameterActionWithStringParameterValue(GERRIT_CHANGE_ID.name(), event.getChange().getId()));
//Just to make sure one more normal arguments is there as well.
verify(project).scheduleBuild2(
anyInt(),
same(gerritCause),
isA(Action.class),