Skip to content

Commit b43ef2f

Browse files
Merge pull request #91 from jenkinsci/migrate_to_junit5
Migrate tests to JUnit5
2 parents f7e9a66 + 3069ab2 commit b43ef2f

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/test/java/io/jenkins/plugins/httpclient5/SmokeTest.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,21 @@
3030
import org.apache.hc.client5.http.fluent.Request;
3131
import org.apache.hc.client5.http.fluent.Response;
3232
import org.apache.hc.core5.http.HttpStatus;
33-
import org.junit.Rule;
34-
import org.junit.Test;
35-
import org.jvnet.hudson.test.JenkinsRule;
36-
import org.jvnet.hudson.test.RealJenkinsRule;
33+
import org.junit.jupiter.api.Test;
34+
import org.junit.jupiter.api.extension.RegisterExtension;
35+
import org.jvnet.hudson.test.junit.jupiter.RealJenkinsExtension;
3736

38-
public class SmokeTest {
37+
class SmokeTest {
3938

40-
@Rule
41-
public RealJenkinsRule rr = new RealJenkinsRule();
39+
@RegisterExtension
40+
private final RealJenkinsExtension extension = new RealJenkinsExtension();
4241

4342
@Test
44-
public void smokeTest() throws Throwable {
45-
rr.then(SmokeTest::_smokeTest);
46-
}
47-
48-
private static void _smokeTest(JenkinsRule r) throws Exception {
49-
URI uri = r.getURL().toURI();
50-
Response response = Request.get(uri).execute();
51-
assertEquals(HttpStatus.SC_OK, response.returnResponse().getCode());
43+
void smokeTest() throws Throwable {
44+
extension.then(r -> {
45+
URI uri = r.getURL().toURI();
46+
Response response = Request.get(uri).execute();
47+
assertEquals(HttpStatus.SC_OK, response.returnResponse().getCode());
48+
});
5249
}
5350
}

0 commit comments

Comments
 (0)