Skip to content

Commit a1b28ea

Browse files
committed
Migrate from JUnit 4 to JUnit 5
1 parent 73817d1 commit a1b28ea

File tree

67 files changed

+1109
-1021
lines changed

Some content is hidden

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

67 files changed

+1109
-1021
lines changed

pom.xml

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
35

46
<modelVersion>4.0.0</modelVersion>
57
<groupId>org.gitlab4j</groupId>
@@ -50,13 +52,14 @@
5052
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5153
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5254

53-
<jersey.version>2.30.1</jersey.version>
54-
<jackson.version>2.10.3</jackson.version>
55-
<servlet.version>4.0.3</servlet.version>
55+
<jersey.version>2.34</jersey.version>
56+
<jackson.version>2.12.4</jackson.version>
57+
<servlet.version>4.0.4</servlet.version>
5658
<activation.version>1.2.2</activation.version>
5759

58-
<junit.version>5.6.0</junit.version>
59-
<mockito.version>3.3.0</mockito.version>
60+
<junit.version>5.8.2</junit.version>
61+
<testcontainers.version>1.15.3</testcontainers.version>
62+
<mockito.version>4.1.0</mockito.version>
6063
<hamcrest.version>1.3</hamcrest.version>
6164
<systemRules.version>1.19.0</systemRules.version>
6265

@@ -67,7 +70,7 @@
6770
<gitlab.autoremove-container>true</gitlab.autoremove-container>
6871
<gitlab.skip-docker-start>true</gitlab.skip-docker-start>
6972
<gitlab.port>8090</gitlab.port>
70-
73+
7174
<sonar.projectKey>gitlab4j_gitlab4j-api</sonar.projectKey>
7275
<sonar.organization>gitlab4j</sonar.organization>
7376
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
@@ -121,15 +124,15 @@
121124
</plugin>
122125

123126
<plugin>
124-
<groupId>biz.aQute.bnd</groupId>
125-
<artifactId>bnd-maven-plugin</artifactId>
126-
<executions>
127-
<execution>
128-
<goals>
129-
<goal>bnd-process</goal>
130-
</goals>
131-
</execution>
132-
</executions>
127+
<groupId>biz.aQute.bnd</groupId>
128+
<artifactId>bnd-maven-plugin</artifactId>
129+
<executions>
130+
<execution>
131+
<goals>
132+
<goal>bnd-process</goal>
133+
</goals>
134+
</execution>
135+
</executions>
133136
</plugin>
134137

135138
<plugin>
@@ -179,20 +182,20 @@
179182
</plugin>
180183

181184
<plugin>
182-
<groupId>org.apache.maven.plugins</groupId>
183-
<artifactId>maven-jar-plugin</artifactId>
184-
<version>3.2.0</version>
185-
<configuration>
186-
<archive>
187-
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
188-
</archive>
189-
</configuration>
185+
<groupId>org.apache.maven.plugins</groupId>
186+
<artifactId>maven-jar-plugin</artifactId>
187+
<version>3.2.0</version>
188+
<configuration>
189+
<archive>
190+
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
191+
</archive>
192+
</configuration>
190193
</plugin>
191194

192195
<plugin>
193196
<groupId>org.jacoco</groupId>
194197
<artifactId>jacoco-maven-plugin</artifactId>
195-
<version>0.8.3</version>
198+
<version>0.8.7</version>
196199
<executions>
197200
<execution>
198201
<id>default-prepare-agent</id>
@@ -235,23 +238,24 @@
235238
<plugin>
236239
<groupId>org.apache.maven.plugins</groupId>
237240
<artifactId>maven-surefire-plugin</artifactId>
238-
<version>3.0.0-M3</version>
241+
<version>3.0.0-M5</version>
239242
<configuration>
240-
<excludedGroups>org.gitlab4j.api.IntegrationTest</excludedGroups>
241243
<systemPropertyVariables>
242244
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
243245
</systemPropertyVariables>
246+
<excludedGroups>integration</excludedGroups>
244247
</configuration>
245248
</plugin>
246249

250+
247251
<plugin>
248252
<groupId>org.apache.maven.plugins</groupId>
249253
<artifactId>maven-failsafe-plugin</artifactId>
250-
<version>3.0.0-M3</version>
254+
<version>3.0.0-M5</version>
251255
<configuration>
252-
<groups>org.gitlab4j.api.IntegrationTest</groups>
256+
<groups>integration</groups>
253257
<includes>
254-
<include>**/IntegrationTestSuite.java</include>
258+
<include>**/*.java</include>
255259
</includes>
256260
</configuration>
257261
<executions>
@@ -290,15 +294,15 @@
290294
<dependency>
291295
<groupId>org.codehaus.mojo</groupId>
292296
<artifactId>extra-enforcer-rules</artifactId>
293-
<version>1.2</version>
297+
<version>1.3</version>
294298
</dependency>
295299
</dependencies>
296300
</plugin>
297301

298302
<plugin>
299303
<groupId>org.codehaus.mojo</groupId>
300304
<artifactId>animal-sniffer-maven-plugin</artifactId>
301-
<version>1.17</version>
305+
<version>1.20</version>
302306
<executions>
303307
<execution>
304308
<goals>
@@ -327,7 +331,8 @@
327331
<run>
328332
<skip>${gitlab.skip-docker-start}</skip>
329333
<env>
330-
<GITLAB_OMNIBUS_CONFIG>gitlab_rails['initial_root_password']="password"; gitlab_rails['lfs_enabled']=false;</GITLAB_OMNIBUS_CONFIG>
334+
<GITLAB_OMNIBUS_CONFIG>gitlab_rails['initial_root_password']="password";
335+
gitlab_rails['lfs_enabled']=false;</GITLAB_OMNIBUS_CONFIG>
331336
</env>
332337
<ports>
333338
<port>${gitlab.port}:80</port>
@@ -358,12 +363,12 @@
358363
</execution>
359364
</executions>
360365
</plugin>
361-
362366
</plugins>
363367

364368
<pluginManagement>
365369
<plugins>
366-
<!-- The se.bjurr.gitchangelog:git-changelog-maven-plugin needs to be in -->
370+
<!-- The se.bjurr.gitchangelog:git-changelog-maven-plugin needs to be
371+
in -->
367372
<!-- this section (pluginManagement) for it to work correctly. -->
368373
<plugin>
369374
<groupId>se.bjurr.gitchangelog</groupId>
@@ -382,14 +387,14 @@
382387
</executions>
383388
</plugin>
384389
<plugin>
385-
<groupId>biz.aQute.bnd</groupId>
386-
<artifactId>bnd-maven-plugin</artifactId>
387-
<version>${bnd.version}</version>
388-
<configuration>
389-
<bnd><![CDATA[
390+
<groupId>biz.aQute.bnd</groupId>
391+
<artifactId>bnd-maven-plugin</artifactId>
392+
<version>${bnd.version}</version>
393+
<configuration>
394+
<bnd><![CDATA[
390395
Export-Package: org.gitlab4j.api.*
391396
]]></bnd>
392-
</configuration>
397+
</configuration>
393398
</plugin>
394399
</plugins>
395400
</pluginManagement>
@@ -435,8 +440,8 @@
435440
</dependency>
436441

437442
<dependency>
438-
<groupId>org.junit.vintage</groupId>
439-
<artifactId>junit-vintage-engine</artifactId>
443+
<groupId>org.junit.jupiter</groupId>
444+
<artifactId>junit-jupiter</artifactId>
440445
<version>${junit.version}</version>
441446
<scope>test</scope>
442447
</dependency>
@@ -447,28 +452,27 @@
447452
<scope>test</scope>
448453
</dependency>
449454
<dependency>
450-
<groupId>org.hamcrest</groupId>
451-
<artifactId>hamcrest-all</artifactId>
452-
<version>${hamcrest.version}</version>
455+
<groupId>org.mockito</groupId>
456+
<artifactId>mockito-junit-jupiter</artifactId>
457+
<version>${mockito.version}</version>
453458
<scope>test</scope>
454459
</dependency>
455460
<dependency>
456-
<groupId>com.github.stefanbirkner</groupId>
457-
<artifactId>system-rules</artifactId>
458-
<version>${systemRules.version}</version>
461+
<groupId>org.hamcrest</groupId>
462+
<artifactId>hamcrest-all</artifactId>
463+
<version>${hamcrest.version}</version>
459464
<scope>test</scope>
460465
</dependency>
461466
<dependency>
462-
<groupId>com.googlecode.junit-toolbox</groupId>
463-
<artifactId>junit-toolbox</artifactId>
464-
<version>2.4</version>
465-
<scope>test</scope>
467+
<groupId>uk.org.webcompere</groupId>
468+
<artifactId>system-stubs-jupiter</artifactId>
469+
<version>1.2.0</version>
466470
</dependency>
467471
</dependencies>
468472

469473
<dependencyManagement>
470474
<dependencies>
471-
<!-- Needed for animal-sniffer -->
475+
<!-- Needed for animal-sniffer -->
472476
<dependency>
473477
<groupId>org.codehaus.mojo.signature</groupId>
474478
<artifactId>java18</artifactId>

src/test/java/org/gitlab4j/api/IntegrationTest.java

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

src/test/java/org/gitlab4j/api/PagerSpliteratorTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
package org.gitlab4j.api;
22

3+
import static java.util.Arrays.asList;
4+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
5+
import static org.junit.jupiter.api.Assertions.assertEquals;
6+
import static org.junit.jupiter.api.Assertions.assertFalse;
7+
import static org.junit.jupiter.api.Assertions.assertTrue;
8+
import static org.junit.jupiter.api.Assertions.fail;
9+
import static org.mockito.Mockito.when;
10+
311
import java.util.Collections;
412
import java.util.stream.StreamSupport;
513

6-
import org.junit.Assert;
7-
import org.junit.Before;
8-
import org.junit.Test;
9-
import org.junit.runner.RunWith;
14+
import org.junit.jupiter.api.BeforeEach;
15+
import org.junit.jupiter.api.Test;
16+
import org.junit.jupiter.api.extension.ExtendWith;
1017
import org.mockito.Mock;
11-
import org.mockito.junit.MockitoJUnitRunner;
18+
import org.mockito.junit.jupiter.MockitoExtension;
1219

13-
import static java.util.Arrays.asList;
14-
import static org.junit.Assert.assertArrayEquals;
15-
import static org.junit.Assert.assertEquals;
16-
import static org.junit.Assert.assertFalse;
17-
import static org.junit.Assert.assertTrue;
18-
import static org.mockito.Mockito.when;
19-
20-
@RunWith(MockitoJUnitRunner.class)
20+
@ExtendWith(MockitoExtension.class)
2121
public class PagerSpliteratorTest {
2222

2323
PagerSpliterator<Integer> pagerSpliterator;
2424

2525
@Mock
2626
Pager<Integer> pager;
2727

28-
@Before
28+
@BeforeEach
2929
public void setUp() {
3030
pagerSpliterator = new PagerSpliterator<>(pager);
3131
}
@@ -46,7 +46,7 @@ public void shouldDoNotFailOnEmptySource() {
4646

4747
assertFalse(success);
4848
}
49-
49+
5050
@Test
5151
public void shouldReturnFalseIfNextPagerItemMissing() {
5252
when(pager.hasNext()).thenReturn(true);
@@ -61,7 +61,7 @@ public void shouldReturnFalseIfNextPagerItemMissing() {
6161
public void shouldThrowNullPointerExceptionWhenActionIsMissing() {
6262
try {
6363
pagerSpliterator.tryAdvance(null);
64-
Assert.fail("Missing NullPointerException");
64+
fail("Missing NullPointerException");
6565
} catch (Throwable e) {
6666
assertEquals(NullPointerException.class, e.getClass());
6767
}

0 commit comments

Comments
 (0)