@Before public void before() { settings = mock(Settings.class); when(settings.getBoolean(anyString())).thenReturn(null); when(settings.getString(anyString())).thenReturn(null); configValidator = new ConfigValidator(); }
/** * Send notification to Jenkins for the provided repository. * * @param repo The repository to base the notification on. * @param strRef The branch ref related to the commit * @param strSha1 The commit's SHA1 hash code. * @return Text result from Jenkins */ public @Nullable NotificationResult notify( @Nonnull Repository repo, // CHECKSTYLE:annot String strRef, String strSha1) { final RepositoryHook hook = settingsService.getRepositoryHook(repo); final Settings settings = settingsService.getSettings(repo); if (hook == null || !hook.isEnabled() || settings == null) { LOGGER.debug("Hook not configured correctly or not enabled, returning."); return null; } return notify( repo, settings.getString(JENKINS_BASE), settings.getBoolean(IGNORE_CERTS, false), settings.getString(CLONE_TYPE), settings.getString(CLONE_URL), strRef, strSha1, settings.getBoolean(OMIT_HASH_CODE, false), settings.getBoolean(OMIT_BRANCH_NAME, false)); }