Skip to content

Commit f9a039c

Browse files
Migrate tests to JUnit5
* Migrate annotations and imports * Migrate assertions * Remove public visibility for test classes and methods * Minor code cleanup
1 parent 77d19b7 commit f9a039c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/test/java/io/jenkins/plugins/safebatch/BatchSanitizerGlobalRuleTest.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
*/
2424
package io.jenkins.plugins.safebatch;
2525

26-
import static org.junit.Assert.fail;
27-
import static org.junit.Assume.assumeTrue;
26+
import static org.junit.jupiter.api.Assertions.fail;
27+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
2828

2929
import hudson.Functions;
3030
import hudson.model.Build;
@@ -39,17 +39,23 @@
3939
import hudson.tasks.BatchFile;
4040
import io.jenkins.plugins.environment_filter_utils.matchers.run.ExactJobFullNameRunMatcher;
4141
import jenkins.tasks.filters.EnvVarsFilterGlobalConfiguration;
42-
import org.junit.Rule;
43-
import org.junit.Test;
42+
import org.junit.jupiter.api.BeforeEach;
43+
import org.junit.jupiter.api.Test;
4444
import org.jvnet.hudson.test.JenkinsRule;
45+
import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
4546

46-
public class BatchSanitizerGlobalRuleTest {
47+
@WithJenkins
48+
class BatchSanitizerGlobalRuleTest {
4749

48-
@Rule
49-
public JenkinsRule j = new JenkinsRule();
50+
private JenkinsRule j;
51+
52+
@BeforeEach
53+
void setUp(JenkinsRule rule) {
54+
j = rule;
55+
}
5056

5157
@Test
52-
public void globalRule_canBe_ignoreForGivenJobs() throws Exception {
58+
void globalRule_canBe_ignoreForGivenJobs() throws Exception {
5359
assumeTrue(Functions.isWindows());
5460

5561
EnvVarsFilterGlobalConfiguration.getAllActivatedGlobalRules().clear();

0 commit comments

Comments
 (0)