Skip to content

Commit

Permalink
Added tests for JobInclusionJobProperty class (#421)
Browse files Browse the repository at this point in the history
* added-tests

Signed-off-by: shinigami-777 <[email protected]>

* removed comments and mvn spotless:apply done

Signed-off-by: shinigami-777 <[email protected]>

* Move test class to correct directory

Use a single JenkinsRule for the entire set of tests because we don't
need a new Jenkins instance for any of the tests.  Makes the tests faster,
especially on Windows.

* made explicit imports

---------

Signed-off-by: shinigami-777 <[email protected]>
Co-authored-by: Mark Waite <[email protected]>
  • Loading branch information
shinigami-777 and MarkEWaite authored Dec 28, 2024
1 parent 31acb9d commit 4e99a3f
Showing 1 changed file with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package jenkins.advancedqueue.jobinclusion.strategy;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;

public class JobInclusionJobPropertyTest {
private JobInclusionJobProperty jobProperty;
private JobInclusionJobProperty.DescriptorImpl descriptor;

@Rule
public JenkinsRule jenkinsRule = new JenkinsRule();

@Before
public void setup() {
jobProperty = new JobInclusionJobProperty(true, "TestJobGroup");
descriptor = new JobInclusionJobProperty.DescriptorImpl();
}

@Test
public void getJobGroupNameTest() {
assertEquals("TestJobGroup", jobProperty.getJobGroupName());
}

@Test
public void isUseJobGroupTest() {
assertTrue(jobProperty.isUseJobGroup());
}

@Test
public void getDescriptorTest() {
assertNotNull(jobProperty.getDescriptor());
}

@Test
public void getDisplayNameTest() {
assertEquals("XXX", descriptor.getDisplayName());
}

@Test
public void getJobGroupsTest() {
assertNotNull(descriptor.getJobGroups());
}

@Test
public void isUsedTest() {
assertFalse(descriptor.isUsed());
}
}

0 comments on commit 4e99a3f

Please sign in to comment.