Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-42310] Added Test cases for the GitRef Lint defect
  • Loading branch information
v1v committed Feb 25, 2017
1 parent cf799aa commit 57f1fd6
Showing 1 changed file with 37 additions and 0 deletions.
@@ -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;
Expand Down Expand Up @@ -67,6 +70,40 @@ public class GitRefCheckerTestCase {
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()));
Expand Down

0 comments on commit 57f1fd6

Please sign in to comment.