Skip to content

Commit 95deae6

Browse files
committed
#718: replace junit:junit:4.13.2:test with org.junit.jupiter:junit-jupiter-*:5.10.2:test
1 parent f7048fc commit 95deae6

19 files changed

+247
-261
lines changed

pom.xml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<maven-plugin-api.version>3.9.6</maven-plugin-api.version>
5353
<maven-plugin-plugin.version>3.11.0</maven-plugin-plugin.version>
5454

55-
<junit.version>4.13.2</junit.version>
55+
<junit.version>5.10.2</junit.version>
5656
<mockito.version>5.10.0</mockito.version>
5757

5858
<assertj.version>3.25.3</assertj.version>
@@ -320,8 +320,20 @@
320320

321321
<!-- Test stuff -->
322322
<dependency>
323-
<groupId>junit</groupId>
324-
<artifactId>junit</artifactId>
323+
<groupId>org.junit.jupiter</groupId>
324+
<artifactId>junit-jupiter-api</artifactId>
325+
<version>${junit.version}</version>
326+
<scope>test</scope>
327+
</dependency>
328+
<dependency>
329+
<groupId>org.junit.jupiter</groupId>
330+
<artifactId>junit-jupiter-engine</artifactId>
331+
<version>${junit.version}</version>
332+
<scope>test</scope>
333+
</dependency>
334+
<dependency>
335+
<groupId>org.junit.jupiter</groupId>
336+
<artifactId>junit-jupiter-params</artifactId>
325337
<version>${junit.version}</version>
326338
<scope>test</scope>
327339
</dependency>
@@ -348,13 +360,6 @@
348360
<scope>test</scope>
349361
</dependency>
350362

351-
<dependency>
352-
<groupId>pl.pragmatists</groupId>
353-
<artifactId>JUnitParams</artifactId>
354-
<version>1.1.1</version>
355-
<scope>test</scope>
356-
</dependency>
357-
358363
<!--to avoid complaints during tests -->
359364
<dependency>
360365
<groupId>org.slf4j</groupId>

src/test/java/pl/project13/core/jgit/DescribeCommandIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.eclipse.jgit.lib.ObjectId;
3333
import org.eclipse.jgit.lib.Repository;
3434
import org.eclipse.jgit.revwalk.RevCommit;
35-
import org.junit.Test;
35+
import org.junit.jupiter.api.Test;
3636
import pl.project13.log.DummyTestLoggerBridge;
3737
import pl.project13.maven.git.AvailableGitTestRepo;
3838
import pl.project13.maven.git.GitIntegrationTest;

src/test/java/pl/project13/core/jgit/DescribeResultTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import org.eclipse.jgit.api.ResetCommand;
2626
import org.eclipse.jgit.lib.ObjectId;
2727
import org.eclipse.jgit.lib.Repository;
28-
import org.junit.Before;
29-
import org.junit.Test;
28+
import org.junit.jupiter.api.BeforeEach;
29+
import org.junit.jupiter.api.Test;
3030
import pl.project13.maven.git.AvailableGitTestRepo;
3131
import pl.project13.maven.git.GitIntegrationTest;
3232

@@ -45,7 +45,7 @@ public class DescribeResultTest extends GitIntegrationTest {
4545
static final String DIRTY_MARKER = "-DEV";
4646

4747
@Override
48-
@Before
48+
@BeforeEach
4949
public void setUp() throws Exception {
5050
super.setUp();
5151

src/test/java/pl/project13/maven/git/AheadBehindTest.java

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818

1919
package pl.project13.maven.git;
2020

21-
import static org.junit.Assert.assertEquals;
21+
import static org.junit.jupiter.api.Assertions.assertEquals;
2222

2323
import java.io.File;
24+
import java.nio.file.Path;
2425
import org.eclipse.jgit.api.Git;
2526
import org.eclipse.jgit.lib.ConfigConstants;
2627
import org.eclipse.jgit.lib.StoredConfig;
27-
import org.junit.After;
28-
import org.junit.Before;
29-
import org.junit.Rule;
30-
import org.junit.Test;
31-
import org.junit.rules.TemporaryFolder;
28+
import org.junit.jupiter.api.AfterEach;
29+
import org.junit.jupiter.api.BeforeEach;
30+
import org.junit.jupiter.api.Test;
31+
import org.junit.jupiter.api.io.TempDir;
3232
import pl.project13.core.AheadBehind;
3333
import pl.project13.core.GitProvider;
3434

@@ -37,19 +37,22 @@
3737
*/
3838
public abstract class AheadBehindTest<T extends GitProvider> {
3939

40-
@Rule public TemporaryFolder remoteRepository = new TemporaryFolder();
40+
@TempDir
41+
public Path remoteRepository;
4142

42-
@Rule public TemporaryFolder localRepository = new TemporaryFolder();
43+
@TempDir
44+
public Path localRepository;
4345

44-
@Rule public TemporaryFolder secondLocalRepository = new TemporaryFolder();
46+
@TempDir
47+
public Path secondLocalRepository;
4548

4649
protected Git localRepositoryGit;
4750

4851
protected Git secondLocalRepositoryGit;
4952

5053
protected T gitProvider;
5154

52-
@Before
55+
@BeforeEach
5356
public void setup() throws Exception {
5457

5558
createRemoteRepository();
@@ -65,7 +68,7 @@ public void setup() throws Exception {
6568
extraSetup();
6669
}
6770

68-
@After
71+
@AfterEach
6972
public void tearDown() throws Exception {
7073
if (localRepositoryGit != null) {
7174
localRepositoryGit.close();
@@ -122,30 +125,30 @@ public void shouldBe1AheadAnd1Behind() throws Exception {
122125
}
123126

124127
protected void createLocalCommit() throws Exception {
125-
File newFile = localRepository.newFile();
128+
File newFile = localRepository.toFile();
126129
localRepositoryGit.add().addFilepattern(newFile.getName()).call();
127130
localRepositoryGit.commit().setMessage("ahead").call();
128131
}
129132

130133
protected void createCommitInSecondRepoAndPush() throws Exception {
131134
secondLocalRepositoryGit.pull().call();
132135

133-
File newFile = secondLocalRepository.newFile();
136+
File newFile = secondLocalRepository.toFile();
134137
secondLocalRepositoryGit.add().addFilepattern(newFile.getName()).call();
135138
secondLocalRepositoryGit.commit().setMessage("behind").call();
136139

137140
secondLocalRepositoryGit.push().call();
138141
}
139142

140143
protected void createRemoteRepository() throws Exception {
141-
Git.init().setBare(true).setDirectory(remoteRepository.getRoot()).call();
144+
Git.init().setBare(true).setDirectory(remoteRepository.toFile()).call();
142145
}
143146

144147
protected void setupLocalRepository() throws Exception {
145148
localRepositoryGit =
146149
Git.cloneRepository()
147-
.setURI(remoteRepository.getRoot().toURI().toString())
148-
.setDirectory(localRepository.getRoot())
150+
.setURI(remoteRepository.toFile().toURI().toString())
151+
.setDirectory(localRepository.toFile())
149152
.setBranch("master")
150153
.call();
151154

@@ -158,14 +161,14 @@ protected void setupLocalRepository() throws Exception {
158161
protected void setupSecondLocalRepository() throws Exception {
159162
secondLocalRepositoryGit =
160163
Git.cloneRepository()
161-
.setURI(remoteRepository.getRoot().toURI().toString())
162-
.setDirectory(secondLocalRepository.getRoot())
164+
.setURI(remoteRepository.toFile().toURI().toString())
165+
.setDirectory(secondLocalRepository.toFile())
163166
.setBranch("master")
164167
.call();
165168
}
166169

167170
protected void createAndPushInitialCommit() throws Exception {
168-
File newFile = localRepository.newFile();
171+
File newFile = localRepository.toFile();
169172
localRepositoryGit.add().addFilepattern(newFile.getName()).call();
170173
localRepositoryGit.commit().setMessage("initial").call();
171174

src/test/java/pl/project13/maven/git/BigDiffTest.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,12 @@
1818

1919
package pl.project13.maven.git;
2020

21-
import static org.assertj.core.api.Assertions.assertThat;
22-
2321
import java.io.FileOutputStream;
2422
import java.nio.file.Files;
2523
import java.nio.file.Path;
2624
import java.nio.file.Paths;
27-
import java.util.Properties;
28-
import junitparams.JUnitParamsRunner;
2925
import org.apache.maven.project.MavenProject;
30-
import org.junit.Test;
31-
import org.junit.runner.RunWith;
26+
import org.junit.jupiter.api.Test;
3227
import pl.project13.core.git.GitDescribeConfig;
3328

3429
/**
@@ -38,7 +33,6 @@
3833
*
3934
* @author eternach
4035
*/
41-
@RunWith(JUnitParamsRunner.class)
4236
public class BigDiffTest extends GitIntegrationTest {
4337

4438
@Test

0 commit comments

Comments
 (0)