Skip to content

Commit 330a32f

Browse files
authored
Migrate tests to JUnit5 (core / hudson / 2) (#10577)
2 parents 7732f55 + 8759961 commit 330a32f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1461
-1267
lines changed

core/src/test/java/hudson/BulkChangeTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424

2525
package hudson;
2626

27-
import static org.junit.Assert.assertEquals;
27+
import static org.junit.jupiter.api.Assertions.assertEquals;
2828

2929
import hudson.model.Saveable;
3030
import java.io.IOException;
31-
import org.junit.Test;
31+
import org.junit.jupiter.api.Test;
3232

3333
/**
3434
* Tests {@link BulkChange}.
3535
*
3636
* @author Kohsuke Kawaguchi
3737
*/
38-
public class BulkChangeTest {
38+
class BulkChangeTest {
3939

4040
private static class Point implements Saveable {
4141
/**
@@ -72,7 +72,7 @@ public void save() {
7272
* If there is no BulkChange, we should see two saves.
7373
*/
7474
@Test
75-
public void noBulkChange() throws Exception {
75+
void noBulkChange() throws Exception {
7676
Point pt = new Point();
7777
pt.set(0, 0);
7878
assertEquals(2, pt.saveCount);
@@ -82,7 +82,7 @@ public void noBulkChange() throws Exception {
8282
* With a {@link BulkChange}, this will become just one save.
8383
*/
8484
@Test
85-
public void bulkChange() throws Exception {
85+
void bulkChange() throws Exception {
8686
Point pt = new Point();
8787
BulkChange bc = new BulkChange(pt);
8888
try {
@@ -97,7 +97,7 @@ public void bulkChange() throws Exception {
9797
* {@link BulkChange}s can be nested.
9898
*/
9999
@Test
100-
public void nestedBulkChange() throws Exception {
100+
void nestedBulkChange() throws Exception {
101101
Point pt = new Point();
102102
Point pt2 = new Point();
103103
BulkChange bc1 = new BulkChange(pt);

core/src/test/java/hudson/ChannelRule.java

Lines changed: 0 additions & 64 deletions
This file was deleted.

core/src/test/java/hudson/ClassicPluginStrategyTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
/**
3838
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
3939
*/
40-
public class ClassicPluginStrategyTest {
40+
class ClassicPluginStrategyTest {
4141

4242
@Test
43-
public void test_getDetachedPlugins() {
43+
void test_getDetachedPlugins() {
4444
List<DetachedPlugin> list = DetachedPluginsUtil.getDetachedPlugins(new VersionNumber("1.296"));
4545

4646
assertTrue(list.size() >= 14); // There were 14 at the time of writing this test

core/src/test/java/hudson/EnvVarsTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@
4141
/**
4242
* @author Kohsuke Kawaguchi
4343
*/
44-
public class EnvVarsTest {
44+
class EnvVarsTest {
4545

4646
@Test
47-
public void caseInsensitive() {
47+
void caseInsensitive() {
4848
EnvVars ev = new EnvVars(Map.of("Path", "A:B:C"));
4949
assertTrue(ev.containsKey("PATH"));
5050
assertEquals("A:B:C", ev.get("PATH"));
5151
}
5252

5353
@Test
54-
public void overrideExpandingAll() {
54+
void overrideExpandingAll() {
5555
EnvVars env = new EnvVars();
5656
env.put("PATH", "orig");
5757
env.put("A", "Value1");
@@ -71,7 +71,7 @@ public void overrideExpandingAll() {
7171
}
7272

7373
@Test
74-
public void overrideOrderCalculatorSimple() {
74+
void overrideOrderCalculatorSimple() {
7575
EnvVars env = new EnvVars();
7676
EnvVars overrides = new EnvVars();
7777
overrides.put("A", "NoReference");
@@ -87,7 +87,7 @@ public void overrideOrderCalculatorSimple() {
8787
}
8888

8989
@Test
90-
public void overrideOrderCalculatorInOrder() {
90+
void overrideOrderCalculatorInOrder() {
9191
EnvVars env = new EnvVars();
9292
EnvVars overrides = new EnvVars();
9393
overrides.put("A", "NoReference");
@@ -102,7 +102,7 @@ public void overrideOrderCalculatorInOrder() {
102102
}
103103

104104
@Test
105-
public void overrideOrderCalculatorMultiple() {
105+
void overrideOrderCalculatorMultiple() {
106106
EnvVars env = new EnvVars();
107107
EnvVars overrides = new EnvVars();
108108
overrides.put("A", "Noreference");
@@ -115,7 +115,7 @@ public void overrideOrderCalculatorMultiple() {
115115
}
116116

117117
@Test
118-
public void overrideOrderCalculatorSelfReference() {
118+
void overrideOrderCalculatorSelfReference() {
119119
EnvVars env = new EnvVars();
120120
EnvVars overrides = new EnvVars();
121121
overrides.put("PATH", "some;${PATH}");
@@ -126,7 +126,7 @@ public void overrideOrderCalculatorSelfReference() {
126126
}
127127

128128
@Test
129-
public void overrideOrderCalculatorCyclic() {
129+
void overrideOrderCalculatorCyclic() {
130130
EnvVars env = new EnvVars();
131131
env.put("C", "Existing");
132132
EnvVars overrides = new EnvVars();
@@ -144,7 +144,7 @@ public void overrideOrderCalculatorCyclic() {
144144
}
145145

146146
@Test
147-
public void putIfNotNull() {
147+
void putIfNotNull() {
148148
EnvVars env = new EnvVars();
149149
env.putIfNotNull("foo", null);
150150
assertTrue(env.isEmpty());
@@ -153,7 +153,7 @@ public void putIfNotNull() {
153153
}
154154

155155
@Test
156-
public void putAllNonNull() {
156+
void putAllNonNull() {
157157
EnvVars env = new EnvVars();
158158
TreeMap<String, String> map = new TreeMap<>();
159159
map.put("A", "a");

0 commit comments

Comments
 (0)