Skip to content

Commit f60c88b

Browse files
strangelookingnerdmymarche
authored andcommitted
Migrate tests to JUnit5
* Migrate annotations and imports * Migrate assertions * Remove public visibility for test classes and methods * Minor code cleanup
1 parent 848a898 commit f60c88b

File tree

4 files changed

+289
-267
lines changed

4 files changed

+289
-267
lines changed

pom.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<dependency>
7070
<groupId>io.jenkins.tools.bom</groupId>
7171
<artifactId>bom-${jenkins.baseline}.x</artifactId>
72-
<version>3944.v1a_e4f8b_452db_</version>
72+
<version>4136.vca_c3202a_7fd1</version>
7373
<scope>import</scope>
7474
<type>pom</type>
7575
</dependency>
@@ -108,7 +108,6 @@
108108
<dependency>
109109
<groupId>io.jenkins.plugins</groupId>
110110
<artifactId>okhttp-api</artifactId>
111-
<version>4.11.0-183.va_87fc7a_89810</version>
112111
</dependency>
113112
<dependency>
114113
<groupId>io.jenkins.plugins</groupId>
@@ -124,7 +123,6 @@
124123
<dependency>
125124
<groupId>org.jenkins-ci.plugins</groupId>
126125
<artifactId>antisamy-markup-formatter</artifactId>
127-
<version>173.v680e3a_b_69ff3</version>
128126
<optional>true</optional>
129127
</dependency>
130128

src/test/java/io/jenkins/plugins/restlistparam/RestValueServiceTest.java

+16-11
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,35 @@
55
import io.jenkins.plugins.restlistparam.model.ValueItem;
66
import io.jenkins.plugins.restlistparam.model.ResultContainer;
77
import io.jenkins.plugins.restlistparam.model.ValueOrder;
8-
import org.junit.Assert;
9-
import org.junit.Test;
8+
import org.junit.jupiter.api.Test;
109

1110
import java.util.List;
1211

12+
import static org.junit.jupiter.api.Assertions.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.assertFalse;
14+
import static org.junit.jupiter.api.Assertions.assertNotNull;
15+
import static org.junit.jupiter.api.Assertions.assertTrue;
16+
1317
// Task for later: more unit tests here (preferably replace integration tests)
14-
public class RestValueServiceTest {
18+
class RestValueServiceTest {
19+
1520
@Test
16-
public void successfulGetIntegrationTest() {
21+
void successfulGetIntegrationTest() {
1722
ResultContainer<List<ValueItem>> test = RestValueService
18-
.get("http://api.github.com/repos/jellyfin/jellyfin/tags?per_page=3",
23+
.get("https://api.github.com/repos/jellyfin/jellyfin/tags?per_page=3",
1924
null,
2025
MimeType.APPLICATION_JSON,
2126
0,
2227
"$.*.name",
2328
"$",
2429
null,
2530
ValueOrder.NONE);
26-
Assert.assertFalse(test.getErrorMsg().isPresent());
27-
Assert.assertEquals(3, test.getValue().size());
31+
assertFalse(test.getErrorMsg().isPresent());
32+
assertEquals(3, test.getValue().size());
2833
}
2934

3035
@Test
31-
public void unsuccessfulGetIntegrationTest() {
36+
void unsuccessfulGetIntegrationTest() {
3237
ResultContainer<List<ValueItem>> test = RestValueService
3338
.get("https://gitlab.example.com/api/v4/projects/gitlab-org%2Fgitlab-runner/releases",
3439
null,
@@ -38,8 +43,8 @@ public void unsuccessfulGetIntegrationTest() {
3843
"$",
3944
null,
4045
ValueOrder.NONE);
41-
Assert.assertNotNull(test);
42-
Assert.assertTrue(test.getErrorMsg().isPresent());
43-
Assert.assertEquals(0, test.getValue().size());
46+
assertNotNull(test);
47+
assertTrue(test.getErrorMsg().isPresent());
48+
assertEquals(0, test.getValue().size());
4449
}
4550
}

0 commit comments

Comments
 (0)