@Test public void testGetPreviousNonPreviousNonPersonalBuild_WhenPersonalPreviousReturnsNull() { WebHookContentBuilder builder = new WebHookContentBuilder(null, null, resolverManager, webHookParameterStore); WebHook wh = factory.getWebHook(); SBuild runningBuild = mock(SBuild.class); SFinishedBuild personalPreviousBuild = mock(SFinishedBuild.class); when(runningBuild.getPreviousFinished()).thenReturn(personalPreviousBuild); when(runningBuild.getBuildId()).thenReturn(100L); when(personalPreviousBuild.isPersonal()).thenReturn(true); when(personalPreviousBuild.getBuildId()).thenReturn(99L); when(personalPreviousBuild.getPreviousFinished()).thenReturn(null); SBuild previousBuild = builder.getPreviousNonPersonalBuild(wh, runningBuild); assertNull(previousBuild); assertNull(wh.getPreviousNonPersonalBuild()); }
@Nullable protected SFinishedBuild getPreviousNonPersonalBuild(WebHook wh, SBuild paramSBuild) { if (wh.getPreviousNonPersonalBuild() != null) { return wh.getPreviousNonPersonalBuild(); } wh.setPreviousNonPersonalBuild(getRecursivePreviousNonPersonalBuild(paramSBuild)); return wh.getPreviousNonPersonalBuild(); }
WebHookContentBuilder { @Nullable protected SFinishedBuild getPreviousNonPersonalBuild(WebHook wh, SBuild paramSBuild) { if (wh.getPreviousNonPersonalBuild() != null) { return wh.getPreviousNonPersonalBuild(); } wh.setPreviousNonPersonalBuild(getRecursivePreviousNonPersonalBuild(paramSBuild)); return wh.getPreviousNonPersonalBuild(); } }
WebHookContentBuilder { @Nullable protected SFinishedBuild getPreviousNonPersonalBuild(WebHook wh, SBuild paramSBuild) { if (wh.getPreviousNonPersonalBuild() != null) { return wh.getPreviousNonPersonalBuild(); } wh.setPreviousNonPersonalBuild(getRecursivePreviousNonPersonalBuild(paramSBuild)); return wh.getPreviousNonPersonalBuild(); } WebHookContentBuilder(SBuildServer server, WebHookTemplateResolver resolver, WebHookVariableResolverManager variableResolverManager, WebHookParameterStore webHookParameterStore);  WebHookContentBuilder(SBuildServer server, WebHookTemplateResolver resolver, WebHookVariableResolverManager variableResolverManager, WebHookParameterStoreFactory webHookParameterStoreFactory); }
WebHookContentBuilder { @Nullable protected SFinishedBuild getPreviousNonPersonalBuild(WebHook wh, SBuild paramSBuild) { if (wh.getPreviousNonPersonalBuild() != null) { return wh.getPreviousNonPersonalBuild(); } wh.setPreviousNonPersonalBuild(getRecursivePreviousNonPersonalBuild(paramSBuild)); return wh.getPreviousNonPersonalBuild(); } WebHookContentBuilder(SBuildServer server, WebHookTemplateResolver resolver, WebHookVariableResolverManager variableResolverManager, WebHookParameterStore webHookParameterStore);  WebHookContentBuilder(SBuildServer server, WebHookTemplateResolver resolver, WebHookVariableResolverManager variableResolverManager, WebHookParameterStoreFactory webHookParameterStoreFactory); WebHook buildWebHookContent(WebHook wh, WebHookConfig whc, SQueuedBuild sBuild, BuildStateEnum state,
			String user, String comment, boolean overrideIsEnabled); WebHook buildWebHookContent(WebHook wh, WebHookConfig whc, SBuild sBuild, BuildStateEnum state, String username, String comment, boolean isOverrideEnabled); WebHook buildWebHookContent(WebHook wh, WebHookConfig whc,
			WebHookResponsibilityHolder responsibilityHolder, BuildStateEnum state, boolean isOverrideEnabled); static String getPreferredDateFormat(WebHookTemplateContent templateContent); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, WebHook wh, String url, BuildStateEnum buildState, SBuild sBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, String url, BuildStateEnum buildState, SBuild sBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates, String user, String comment); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, String url, VariableMessageBuilder builder); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, String url, BuildStateEnum buildState, WebHookResponsibilityHolder responsibilityHolder, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, WebHook wh, BuildStateEnum buildState, SBuild runningBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, BuildStateEnum buildState, SBuild runningBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates, String user, String comment); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, BuildStateEnum buildState, SQueuedBuild queuedBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates, String user, String comment); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, BuildStateEnum buildState, WebHookResponsibilityHolder responsibilityHolder, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); WebHookTemplateContent findTemplateForState(
			SBuild sRunningBuild, BuildStateEnum state,
			String payloadtemplateName); WebHookTemplateContent findTemplateForState(
			SQueuedBuild sQueuedBuild, BuildStateEnum state,
			String payloadtemplateName); WebHookTemplateContent findTemplateForState(
			SProject sProject, BuildStateEnum state,
			String payloadtemplateName); ExtraParameters mergeParameters(SortedMap<String,String> parametersFromConfig, SProject project, SBuild build, String preferredDateFormat); }
WebHookContentBuilder { @Nullable protected SFinishedBuild getPreviousNonPersonalBuild(WebHook wh, SBuild paramSBuild) { if (wh.getPreviousNonPersonalBuild() != null) { return wh.getPreviousNonPersonalBuild(); } wh.setPreviousNonPersonalBuild(getRecursivePreviousNonPersonalBuild(paramSBuild)); return wh.getPreviousNonPersonalBuild(); } WebHookContentBuilder(SBuildServer server, WebHookTemplateResolver resolver, WebHookVariableResolverManager variableResolverManager, WebHookParameterStore webHookParameterStore);  WebHookContentBuilder(SBuildServer server, WebHookTemplateResolver resolver, WebHookVariableResolverManager variableResolverManager, WebHookParameterStoreFactory webHookParameterStoreFactory); WebHook buildWebHookContent(WebHook wh, WebHookConfig whc, SQueuedBuild sBuild, BuildStateEnum state,
			String user, String comment, boolean overrideIsEnabled); WebHook buildWebHookContent(WebHook wh, WebHookConfig whc, SBuild sBuild, BuildStateEnum state, String username, String comment, boolean isOverrideEnabled); WebHook buildWebHookContent(WebHook wh, WebHookConfig whc,
			WebHookResponsibilityHolder responsibilityHolder, BuildStateEnum state, boolean isOverrideEnabled); static String getPreferredDateFormat(WebHookTemplateContent templateContent); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, WebHook wh, String url, BuildStateEnum buildState, SBuild sBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, String url, BuildStateEnum buildState, SBuild sBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates, String user, String comment); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, String url, VariableMessageBuilder builder); String resolveTemplatedUrl(VariableResolverFactory variableResolverFactory, String url, BuildStateEnum buildState, WebHookResponsibilityHolder responsibilityHolder, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, WebHook wh, BuildStateEnum buildState, SBuild runningBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, BuildStateEnum buildState, SBuild runningBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates, String user, String comment); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, BuildStateEnum buildState, SQueuedBuild queuedBuild, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates, String user, String comment); VariableResolver getVariableResolver(VariableResolverFactory variableResolverFactory, BuildStateEnum buildState, WebHookResponsibilityHolder responsibilityHolder, WebHookContentObjectSerialiser serialiser, ExtraParameters extraParameters, Map<String,String> templates); WebHookTemplateContent findTemplateForState(
			SBuild sRunningBuild, BuildStateEnum state,
			String payloadtemplateName); WebHookTemplateContent findTemplateForState(
			SQueuedBuild sQueuedBuild, BuildStateEnum state,
			String payloadtemplateName); WebHookTemplateContent findTemplateForState(
			SProject sProject, BuildStateEnum state,
			String payloadtemplateName); ExtraParameters mergeParameters(SortedMap<String,String> parametersFromConfig, SProject project, SBuild build, String preferredDateFormat);  }