Skip to content

Commit 20f085e

Browse files
authored
JUnit bump 4 -> 5
2 parents b46e89f + e5cfd14 commit 20f085e

File tree

1,222 files changed

+11670
-10879
lines changed

Some content is hidden

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

1,222 files changed

+11670
-10879
lines changed

archetypes/jersey-heroku-webapp/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import org.glassfish.jersey.server.ResourceConfig;
66
import org.glassfish.jersey.test.JerseyTest;
77

8-
import org.junit.Test;
9-
import static org.junit.Assert.assertEquals;
8+
import org.junit.jupiter.api.Test;
9+
import static org.junit.jupiter.api.Assertions.assertEquals;
1010

1111
import ${package}.MyResource;
1212

archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
</dependency>
3939
-->
4040
<dependency>
41-
<groupId>junit</groupId>
42-
<artifactId>junit</artifactId>
43-
<version>4.12</version>
41+
<groupId>org.junit.jupiter</groupId>
42+
<artifactId>junit-jupiter</artifactId>
43+
<version>\${junit-jupiter.version}</version>
4444
<scope>test</scope>
4545
</dependency>
4646
</dependencies>
@@ -77,6 +77,7 @@
7777

7878
<properties>
7979
<jersey.version>${project.version}</jersey.version>
80+
<junit-jupiter.version>5.9.1</junit-jupiter.version>
8081
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8182
</properties>
8283
</project>

archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/src/test/java/MyResourceTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
import org.glassfish.grizzly.http.server.HttpServer;
88

9-
import org.junit.After;
10-
import org.junit.Before;
11-
import org.junit.Test;
12-
import static org.junit.Assert.assertEquals;
9+
import org.junit.jupiter.api.AfterEach;
10+
import org.junit.jupiter.api.BeforeEach;
11+
import org.junit.jupiter.api.Test;
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
1313

1414
public class MyResourceTest {
1515

1616
private HttpServer server;
1717
private WebTarget target;
1818

19-
@Before
19+
@BeforeEach
2020
public void setUp() throws Exception {
2121
// start the server
2222
server = Main.startServer();
@@ -32,7 +32,7 @@ public void setUp() throws Exception {
3232
target = c.target(Main.BASE_URI);
3333
}
3434

35-
@After
35+
@AfterEach
3636
public void tearDown() throws Exception {
3737
server.stop();
3838
}

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -40,10 +40,10 @@
4040
import org.glassfish.jersey.test.JerseyTest;
4141

4242
import org.hamcrest.Matchers;
43-
import org.junit.Test;
44-
import static org.junit.Assert.assertEquals;
45-
import static org.junit.Assert.assertThat;
46-
import static org.junit.Assert.assertTrue;
43+
import org.junit.jupiter.api.Test;
44+
import static org.junit.jupiter.api.Assertions.assertEquals;
45+
import static org.hamcrest.MatcherAssert.assertThat;
46+
import static org.junit.jupiter.api.Assertions.assertTrue;
4747

4848
/**
4949
* Asynchronous connector test.
@@ -210,7 +210,7 @@ public String call() throws Exception {
210210
}
211211
});
212212

213-
assertTrue("Waiting for results has timed out.", latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS));
213+
assertTrue(latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS), "Waiting for results has timed out.");
214214
final long toc = System.currentTimeMillis();
215215

216216
assertEquals("DONE-1", r1.get());

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -44,12 +44,12 @@
4444
import org.apache.http.auth.UsernamePasswordCredentials;
4545
import org.apache.http.client.CredentialsProvider;
4646
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
47-
import org.junit.Ignore;
48-
import org.junit.Test;
49-
import static org.junit.Assert.assertEquals;
50-
import static org.junit.Assert.assertNotNull;
51-
import static org.junit.Assert.assertTrue;
52-
import static org.junit.Assert.fail;
47+
import org.junit.jupiter.api.Disabled;
48+
import org.junit.jupiter.api.Test;
49+
import static org.junit.jupiter.api.Assertions.assertEquals;
50+
import static org.junit.jupiter.api.Assertions.assertNotNull;
51+
import static org.junit.jupiter.api.Assertions.assertTrue;
52+
import static org.junit.jupiter.api.Assertions.fail;
5353

5454
/**
5555
* @author Paul Sandoz
@@ -398,7 +398,7 @@ public void testAuthGetWithDigestFilter() {
398398
}
399399

400400
@Test
401-
@Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
401+
@Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
402402
+ " Allow repeatable write in jersey?")
403403
public void testAuthPost() {
404404
CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider();
@@ -474,7 +474,7 @@ public void testAuthInteractiveGet() {
474474
}
475475

476476
@Test
477-
@Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
477+
@Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
478478
+ " Allow repeatable write in jersey?")
479479
public void testAuthInteractivePost() {
480480
CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider();

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -34,11 +34,11 @@
3434
import org.glassfish.jersey.server.ResourceConfig;
3535
import org.glassfish.jersey.test.JerseyTest;
3636

37-
import org.junit.Test;
38-
import static org.junit.Assert.assertEquals;
39-
import static org.junit.Assert.assertNotNull;
40-
import static org.junit.Assert.assertNull;
41-
import static org.junit.Assert.assertTrue;
37+
import org.junit.jupiter.api.Test;
38+
import static org.junit.jupiter.api.Assertions.assertEquals;
39+
import static org.junit.jupiter.api.Assertions.assertNotNull;
40+
import static org.junit.jupiter.api.Assertions.assertNull;
41+
import static org.junit.jupiter.api.Assertions.assertTrue;
4242

4343
/**
4444
* @author Paul Sandoz

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -27,7 +27,7 @@
2727
import javax.ws.rs.container.ContainerResponseContext;
2828
import javax.ws.rs.container.ContainerResponseFilter;
2929

30-
import static org.junit.Assert.assertEquals;
30+
import static org.junit.jupiter.api.Assertions.assertEquals;
3131

3232
/**
3333
* Custom logging filter.
@@ -43,28 +43,28 @@ public class CustomLoggingFilter implements ContainerRequestFilter, ContainerRes
4343
@Override
4444
public void filter(ClientRequestContext context) throws IOException {
4545
System.out.println("CustomLoggingFilter.preFilter called");
46-
assertEquals(context.getConfiguration().getProperty("foo"), "bar");
46+
assertEquals("bar", context.getConfiguration().getProperty("foo"));
4747
preFilterCalled++;
4848
}
4949

5050
@Override
5151
public void filter(ClientRequestContext context, ClientResponseContext clientResponseContext) throws IOException {
5252
System.out.println("CustomLoggingFilter.postFilter called");
53-
assertEquals(context.getConfiguration().getProperty("foo"), "bar");
53+
assertEquals("bar", context.getConfiguration().getProperty("foo"));
5454
postFilterCalled++;
5555
}
5656

5757
@Override
5858
public void filter(ContainerRequestContext context) throws IOException {
5959
System.out.println("CustomLoggingFilter.preFilter called");
60-
assertEquals(context.getProperty("foo"), "bar");
60+
assertEquals("bar", context.getProperty("foo"));
6161
preFilterCalled++;
6262
}
6363

6464
@Override
6565
public void filter(ContainerRequestContext context, ContainerResponseContext containerResponseContext) throws IOException {
6666
System.out.println("CustomLoggingFilter.postFilter called");
67-
assertEquals(context.getProperty("foo"), "bar");
67+
assertEquals("bar", context.getProperty("foo"));
6868
postFilterCalled++;
6969
}
7070
}

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -30,8 +30,8 @@
3030
import org.glassfish.jersey.test.JerseyTest;
3131

3232
import org.apache.http.client.config.RequestConfig;
33-
import org.junit.Test;
34-
import static org.junit.Assert.assertEquals;
33+
import org.junit.jupiter.api.Test;
34+
import static org.junit.jupiter.api.Assertions.assertEquals;
3535

3636
/**
3737
* @author Ondrej Kosatka

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -36,8 +36,8 @@
3636
import org.glassfish.jersey.server.ResourceConfig;
3737
import org.glassfish.jersey.test.JerseyTest;
3838

39-
import org.junit.Test;
40-
import static org.junit.Assert.assertEquals;
39+
import org.junit.jupiter.api.Test;
40+
import static org.junit.jupiter.api.Assertions.assertEquals;
4141

4242
/**
4343
* Apache connector follow redirect tests.

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -34,8 +34,8 @@
3434
import org.glassfish.jersey.server.ResourceConfig;
3535
import org.glassfish.jersey.test.JerseyTest;
3636

37-
import org.junit.Test;
38-
import static org.junit.Assert.assertTrue;
37+
import org.junit.jupiter.api.Test;
38+
import static org.junit.jupiter.api.Assertions.assertTrue;
3939

4040
/**
4141
* @author Paul Sandoz

0 commit comments

Comments
 (0)