-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into job-inclusion-job-property-test
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...test/java/jenkins/advancedqueue/jobinclusion/strategy/JobInclusionFolderPropertyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package jenkins.advancedqueue.jobinclusion.strategy; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.empty; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import hudson.model.FreeStyleProject; | ||
import hudson.model.Run; | ||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
public class JobInclusionFolderPropertyTest { | ||
|
||
@ClassRule | ||
public static JenkinsRule j = new JenkinsRule(); | ||
|
||
private static FreeStyleProject project; | ||
private static JobInclusionFolderProperty property; | ||
|
||
@BeforeClass | ||
public static void createProject() throws Exception { | ||
project = j.createFreeStyleProject(); | ||
Run r = project.scheduleBuild2(0).get(); // Schedule a build to ensure the queue item is created | ||
j.assertBuildStatusSuccess(r); | ||
property = new JobInclusionFolderProperty(true, "testGroup"); | ||
} | ||
|
||
@Test | ||
public void testGetJobGroupName() { | ||
assertEquals("testGroup", property.getJobGroupName()); | ||
} | ||
|
||
@Test | ||
public void testIsUseJobGroup() { | ||
assertTrue(property.isUseJobGroup()); | ||
} | ||
|
||
@Test | ||
public void testGetDescriptor() { | ||
assertThat(property.getDescriptor().getId(), is(JobInclusionFolderProperty.class.getName())); | ||
} | ||
|
||
@Test | ||
public void testDescriptorImpl() { | ||
JobInclusionFolderProperty.DescriptorImpl descriptor = new JobInclusionFolderProperty.DescriptorImpl(); | ||
assertThat(descriptor.getDisplayName(), is("XXX")); | ||
assertThat(descriptor.getJobGroups(), is(empty())); | ||
assertFalse(descriptor.isUsed()); | ||
} | ||
|
||
@Test | ||
public void testAllJobsJobInclusionStrategy() { | ||
AllJobsJobInclusionStrategy strategy = new AllJobsJobInclusionStrategy(); | ||
assertTrue(strategy.contains(null, project)); | ||
} | ||
} |