Skip to content
Permalink
Browse files

[JENKINS-42310] Added Test cases for the GitRef Lint defect

  • Loading branch information...
v1v committed Feb 25, 2017
1 parent cf799aa commit 57f1fd66cca96685a8745593ceb2c26c819fb923
Showing with 37 additions and 0 deletions.
  1. +37 −0 src/test/java/org/jenkins/ci/plugins/jenkinslint/check/GitRefCheckerTestCase.java
@@ -1,11 +1,14 @@
package org.jenkins.ci.plugins.jenkinslint.check;

import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.FreeStyleProject;
import hudson.plugins.git.extensions.GitSCMExtension;
import hudson.plugins.git.extensions.impl.CleanCheckout;
import hudson.plugins.git.extensions.impl.CloneOption;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;

import java.util.ArrayList;
@@ -67,6 +70,40 @@
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertFalse(checker.executeCheck(project));
}
@Issue("JENKINS-42310")
@Test public void testMavenModuleJob() throws Exception {
MavenModuleSet project = j.createMavenProject();
assertFalse(checker.executeCheck(project));
}
@Issue("JENKINS-42310")
@Test public void testMavenGit() throws Exception {
MavenModuleSet project = j.createMavenProject();
project.setScm(new hudson.plugins.git.GitSCM(""));
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMavenProject();
ArrayList<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
extensions.add(new CloneOption(false, "${WORKSPACE}/.git-cache", 0));
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertFalse(checker.executeCheck(project));
}
@Issue("JENKINS-42310")
@Test public void testMatrixProject() throws Exception {
MatrixProject project = j.createMatrixProject();
assertFalse(checker.executeCheck(project));
}
@Issue("JENKINS-42310")
@Test public void testMatrixProjectGit() throws Exception {
MatrixProject project = j.createMatrixProject();
project.setScm(new hudson.plugins.git.GitSCM(""));
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject();
ArrayList<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
extensions.add(new CloneOption(false, "${WORKSPACE}/.git-cache", 0));
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertFalse(checker.executeCheck(project));
}
@Test public void testControlComment() throws Exception {
FreeStyleProject project = j.createFreeStyleProject();
assertFalse(checker.isIgnored(project.getDescription()));

0 comments on commit 57f1fd6

Please sign in to comment.
You can’t perform that action at this time.