Skip to content
Permalink
Browse files

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

  • Loading branch information...
v1v committed Feb 25, 2017
1 parent eaca2a7 commit a93a619cdb480bc339b63ab0c01c30551b0ade2d
@@ -1,9 +1,13 @@
package org.jenkins.ci.plugins.jenkinslint.check;

import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.FreeStyleProject;
import hudson.plugins.ws_cleanup.WsCleanup;
import hudson.triggers.TimerTrigger;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;

import static org.junit.Assert.assertFalse;
@@ -71,6 +75,44 @@
project.save();
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 testMavenTimerTrigger() throws Exception {
MavenModuleSet project = j.createMavenProject();
TimerTrigger newTrigger = new TimerTrigger(TIMER_WITHOUT_H);
project.addTrigger(newTrigger);
project.save();
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMavenProject();
newTrigger = new TimerTrigger(TIMER_WITH_H);
project.addTrigger(newTrigger);
project.save();
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 testMatrixTimerTrigger() throws Exception {
MatrixProject project = j.createMatrixProject();
TimerTrigger newTrigger = new TimerTrigger(TIMER_WITHOUT_H);
project.addTrigger(newTrigger);
project.save();
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject();
newTrigger = new TimerTrigger(TIMER_WITH_H);
project.addTrigger(newTrigger);
project.save();
assertFalse(checker.executeCheck(project));
}
@Test public void testControlComment() throws Exception {
FreeStyleProject project = j.createFreeStyleProject();
assertFalse(checker.isIgnored(project.getDescription()));

0 comments on commit a93a619

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