Skip to content

Commit 5e15bd2

Browse files
Bump junit:junit from 4.13.1 to v5 (#300)
* Bump junit:junit from 4.13.1 to 4.13.2 Bumps [junit:junit](https://github.com/junit-team/junit4) from 4.13.1 to 4.13.2. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md) - [Commits](junit-team/junit4@r4.13.1...r4.13.2) --- updated-dependencies: - dependency-name: junit:junit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Update pom.xml to migrate to Junit 5 * Migrate Junit to 5 from 4 * Remove Junit 4 dependency * Remove okhttp-urlconnection as an unused dependency --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yukihiro Okada <[email protected]>
1 parent 34b4f4d commit 5e15bd2

16 files changed

+256
-204
lines changed

pom.xml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<jackson-bind.version>2.14.2</jackson-bind.version>
7171

7272
<okhttp.version>3.14.9</okhttp.version>
73+
<hamcrest.version>2.2</hamcrest.version>
7374

7475
<surefire.version>3.2.2</surefire.version>
7576
<javadoc-plugin.version>3.7.0</javadoc-plugin.version>
@@ -82,6 +83,18 @@
8283
</repository>
8384
</repositories>
8485

86+
<dependencyManagement>
87+
<dependencies>
88+
<dependency>
89+
<groupId>org.junit</groupId>
90+
<artifactId>junit-bom</artifactId>
91+
<version>5.10.2</version>
92+
<type>pom</type>
93+
<scope>import</scope>
94+
</dependency>
95+
</dependencies>
96+
</dependencyManagement>
97+
8598
<dependencies>
8699
<dependency>
87100
<groupId>org.msgpack</groupId>
@@ -96,12 +109,6 @@
96109
<version>${okhttp.version}</version>
97110
</dependency>
98111

99-
<dependency>
100-
<groupId>com.squareup.okhttp3</groupId>
101-
<artifactId>okhttp-urlconnection</artifactId>
102-
<version>${okhttp.version}</version>
103-
</dependency>
104-
105112
<dependency>
106113
<groupId>com.squareup.okhttp3</groupId>
107114
<artifactId>mockwebserver</artifactId>
@@ -182,9 +189,13 @@
182189
</dependency>
183190

184191
<dependency>
185-
<groupId>junit</groupId>
186-
<artifactId>junit</artifactId>
187-
<version>4.13.1</version>
192+
<groupId>org.junit.jupiter</groupId>
193+
<artifactId>junit-jupiter-api</artifactId>
194+
<scope>test</scope>
195+
</dependency>
196+
<dependency>
197+
<groupId>org.junit.jupiter</groupId>
198+
<artifactId>junit-jupiter-engine</artifactId>
188199
<scope>test</scope>
189200
</dependency>
190201

@@ -228,13 +239,13 @@
228239
<dependency>
229240
<groupId>org.hamcrest</groupId>
230241
<artifactId>hamcrest-core</artifactId>
231-
<version>2.2</version>
242+
<version>${hamcrest.version}</version>
232243
<scope>test</scope>
233244
</dependency>
234245
<dependency>
235246
<groupId>org.hamcrest</groupId>
236247
<artifactId>hamcrest-library</artifactId>
237-
<version>2.2</version>
248+
<version>${hamcrest.version}</version>
238249
<scope>test</scope>
239250
</dependency>
240251

src/test/java/com/treasuredata/client/TDRequestErrorHandlerTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
import okhttp3.Request;
88
import okhttp3.Response;
99
import okhttp3.ResponseBody;
10-
import org.junit.After;
11-
import org.junit.Before;
12-
import org.junit.Test;
10+
import org.junit.jupiter.api.AfterEach;
11+
import org.junit.jupiter.api.BeforeEach;
12+
import org.junit.jupiter.api.Test;
1313
import org.slf4j.Logger;
1414
import org.slf4j.LoggerFactory;
1515

1616
import java.time.Instant;
1717
import java.util.Date;
1818
import java.util.Optional;
1919

20-
import static org.hamcrest.Matchers.is;
2120
import static org.hamcrest.MatcherAssert.assertThat;
22-
import static org.junit.Assert.assertFalse;
21+
import static org.hamcrest.Matchers.is;
22+
import static org.junit.jupiter.api.Assertions.assertFalse;
2323

2424
/**
2525
*
@@ -29,14 +29,14 @@ public class TDRequestErrorHandlerTest
2929
private static Logger logger = LoggerFactory.getLogger(TestTDHttpClient.class);
3030
private TDHttpClient client;
3131

32-
@Before
32+
@BeforeEach
3333
public void setUp()
3434
throws Exception
3535
{
3636
client = TDClient.newClient().httpClient;
3737
}
3838

39-
@After
39+
@AfterEach
4040
public void tearDown()
4141
throws Exception
4242
{

src/test/java/com/treasuredata/client/TestBackoff.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,36 @@
1818
*/
1919
package com.treasuredata.client;
2020

21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Assertions;
22+
import org.junit.jupiter.api.Test;
2223

23-
import static org.junit.Assert.assertEquals;
24-
import static org.junit.Assert.assertTrue;
24+
import static org.junit.jupiter.api.Assertions.assertEquals;
25+
import static org.junit.jupiter.api.Assertions.assertTrue;
2526

2627
public class TestBackoff
2728
{
28-
@Test(expected = IllegalArgumentException.class)
29+
@Test
2930
public void invalidBaseIntervalArgument()
3031
{
31-
new ExponentialBackOff(-1, 10000, -1);
32+
Assertions.assertThrows(IllegalArgumentException.class, () -> {
33+
new ExponentialBackOff(-1, 10000, -1);
34+
});
3235
}
3336

34-
@Test(expected = IllegalArgumentException.class)
37+
@Test
3538
public void invalidMaxIntervalArgument()
3639
{
37-
new ExponentialBackOff(1000, -1, 1);
40+
Assertions.assertThrows(IllegalArgumentException.class, () -> {
41+
new ExponentialBackOff(1000, -1, 1);
42+
});
3843
}
3944

40-
@Test(expected = IllegalArgumentException.class)
45+
@Test
4146
public void invalidMultiplierArgument()
4247
{
43-
new FullJitterBackOff(1000, 10000, -1);
48+
Assertions.assertThrows(IllegalArgumentException.class, () -> {
49+
new FullJitterBackOff(1000, 10000, -1);
50+
});
4451
}
4552

4653
@Test

src/test/java/com/treasuredata/client/TestProxyAccess.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import com.treasuredata.client.model.TDTable;
2323
import io.netty.channel.ChannelHandlerContext;
2424
import io.netty.handler.codec.http.HttpRequest;
25-
import org.junit.After;
26-
import org.junit.Before;
27-
import org.junit.Test;
25+
import org.junit.jupiter.api.AfterEach;
26+
import org.junit.jupiter.api.BeforeEach;
27+
import org.junit.jupiter.api.Test;
2828
import org.littleshoot.proxy.HttpFilters;
2929
import org.littleshoot.proxy.HttpFiltersSourceAdapter;
3030
import org.littleshoot.proxy.HttpProxyServer;
@@ -46,9 +46,10 @@
4646
import java.util.concurrent.atomic.AtomicInteger;
4747
import java.util.stream.Collectors;
4848

49-
import static org.junit.Assert.assertEquals;
50-
import static org.junit.Assert.assertTrue;
51-
import static org.junit.Assert.fail;
49+
import static org.junit.jupiter.api.Assertions.assertEquals;
50+
import static org.junit.jupiter.api.Assertions.assertFalse;
51+
import static org.junit.jupiter.api.Assertions.assertTrue;
52+
import static org.junit.jupiter.api.Assertions.fail;
5253

5354
public class TestProxyAccess
5455
{
@@ -69,7 +70,7 @@ static int findAvailablePort()
6970
private static final String PROXY_PASS = "helloproxy";
7071
private AtomicInteger proxyAccessCount = new AtomicInteger(0);
7172

72-
@Before
73+
@BeforeEach
7374
public void setUp()
7475
throws Exception
7576
{
@@ -106,7 +107,7 @@ public HttpFilters filterRequest(HttpRequest httpRequest, ChannelHandlerContext
106107
}).start();
107108
}
108109

109-
@After
110+
@AfterEach
110111
public void tearDown()
111112
throws Exception
112113
{
@@ -167,7 +168,7 @@ public void proxyApiAccess()
167168
assertTrue(tableList.size() >= 2);
168169

169170
TDJobList jobList = client.listJobs();
170-
assertTrue(jobList.getJobs().size() > 0);
171+
assertFalse(jobList.getJobs().isEmpty());
171172

172173
logger.debug("proxy access count: {}", proxyAccessCount);
173174
assertEquals(1, proxyAccessCount.get());

src/test/java/com/treasuredata/client/TestSSLProxyAccess.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import com.treasuredata.client.model.TDTable;
2323
import io.netty.channel.ChannelHandlerContext;
2424
import io.netty.handler.codec.http.HttpRequest;
25-
import org.junit.After;
26-
import org.junit.Before;
27-
import org.junit.Test;
25+
import org.junit.jupiter.api.AfterEach;
26+
import org.junit.jupiter.api.BeforeEach;
27+
import org.junit.jupiter.api.Test;
2828
import org.littleshoot.proxy.HttpFilters;
2929
import org.littleshoot.proxy.HttpFiltersSourceAdapter;
3030
import org.littleshoot.proxy.HttpProxyServer;
@@ -35,9 +35,9 @@
3535
import java.util.List;
3636
import java.util.concurrent.atomic.AtomicInteger;
3737

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

4242
/**
4343
*
@@ -51,7 +51,7 @@ public class TestSSLProxyAccess
5151
private static final String PROXY_PASS = "helloproxy";
5252
private AtomicInteger proxyAccessCount = new AtomicInteger(0);
5353

54-
@Before
54+
@BeforeEach
5555
public void setUp()
5656
throws Exception
5757
{
@@ -87,7 +87,7 @@ public HttpFilters filterRequest(HttpRequest httpRequest, ChannelHandlerContext
8787
}).start();
8888
}
8989

90-
@After
90+
@AfterEach
9191
public void tearDown()
9292
throws Exception
9393
{

src/test/java/com/treasuredata/client/TestServerFailures.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import okhttp3.mockwebserver.MockResponse;
2323
import okhttp3.mockwebserver.MockWebServer;
2424
import okhttp3.mockwebserver.RecordedRequest;
25-
import org.junit.After;
26-
import org.junit.Before;
27-
import org.junit.Test;
25+
import org.junit.jupiter.api.AfterEach;
26+
import org.junit.jupiter.api.BeforeEach;
27+
import org.junit.jupiter.api.Test;
2828
import org.slf4j.Logger;
2929
import org.slf4j.LoggerFactory;
3030

@@ -39,12 +39,12 @@
3939
import java.util.concurrent.TimeUnit;
4040
import java.util.stream.Collectors;
4141

42+
import static org.hamcrest.MatcherAssert.assertThat;
4243
import static org.hamcrest.Matchers.anyOf;
4344
import static org.hamcrest.Matchers.instanceOf;
44-
import static org.hamcrest.MatcherAssert.assertThat;
45-
import static org.junit.Assert.assertEquals;
46-
import static org.junit.Assert.assertTrue;
47-
import static org.junit.Assert.fail;
45+
import static org.junit.jupiter.api.Assertions.assertEquals;
46+
import static org.junit.jupiter.api.Assertions.assertTrue;
47+
import static org.junit.jupiter.api.Assertions.fail;
4848

4949
/**
5050
*
@@ -58,15 +58,15 @@ public class TestServerFailures
5858
private MockWebServer server;
5959
private int port;
6060

61-
@Before
61+
@BeforeEach
6262
public void setUp()
6363
throws Exception
6464
{
6565
port = TestProxyAccess.findAvailablePort();
6666
server = new MockWebServer();
6767
}
6868

69-
@After
69+
@AfterEach
7070
public void tearDown()
7171
throws Exception
7272
{

0 commit comments

Comments
 (0)