PatchsetCreated event = preparePatchsetCreatedObjForMockTest(change,
new PatchSet(patch), GerritEventType.PATCHSET_CREATED);
//mock the returned url
PowerMockito.mockStatic(PluginImpl.class);
PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
GerritServer server = mock(GerritServer.class);
when(plugin.getServer(any(String.class))).thenReturn(server);
GerritHandler handler = mock(GerritHandler.class);
when(plugin.getHandler()).thenReturn(handler);
IGerritHudsonTriggerConfig config = Setup.createConfig();
config = spy(config);
doReturn("http://mock.url").when(config).getGerritFrontEndUrlFor(any(String.class), any(String.class));
when(server.getConfig()).thenReturn(config);
PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
//prepare GerritTrigger object with the readableMessage setting is on.
GerritTrigger triggerWithReadableMessageOn = Setup.createDefaultTrigger(null);
when(project.getTrigger(GerritTrigger.class)).thenReturn(triggerWithReadableMessageOn);