Skip to content

Commit

Permalink
#718: replace junit:junit:4.13.2:test with org.junit.jupiter:junit-ju…
Browse files Browse the repository at this point in the history
…piter-*:5.10.2:test
  • Loading branch information
TheSnoozer committed Mar 18, 2024
1 parent f7048fc commit 95deae6
Show file tree
Hide file tree
Showing 19 changed files with 247 additions and 261 deletions.
25 changes: 15 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<maven-plugin-api.version>3.9.6</maven-plugin-api.version>
<maven-plugin-plugin.version>3.11.0</maven-plugin-plugin.version>

<junit.version>4.13.2</junit.version>
<junit.version>5.10.2</junit.version>
<mockito.version>5.10.0</mockito.version>

<assertj.version>3.25.3</assertj.version>
Expand Down Expand Up @@ -320,8 +320,20 @@

<!-- Test stuff -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
Expand All @@ -348,13 +360,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>

<!--to avoid complaints during tests -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import pl.project13.log.DummyTestLoggerBridge;
import pl.project13.maven.git.AvailableGitTestRepo;
import pl.project13.maven.git.GitIntegrationTest;
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/pl/project13/core/jgit/DescribeResultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.eclipse.jgit.api.ResetCommand;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import pl.project13.maven.git.AvailableGitTestRepo;
import pl.project13.maven.git.GitIntegrationTest;

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

@Override
@Before
@BeforeEach
public void setUp() throws Exception {
super.setUp();

Expand Down
41 changes: 22 additions & 19 deletions src/test/java/pl/project13/maven/git/AheadBehindTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@

package pl.project13.maven.git;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
import java.nio.file.Path;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.StoredConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import pl.project13.core.AheadBehind;
import pl.project13.core.GitProvider;

Expand All @@ -37,19 +37,22 @@
*/
public abstract class AheadBehindTest<T extends GitProvider> {

@Rule public TemporaryFolder remoteRepository = new TemporaryFolder();
@TempDir
public Path remoteRepository;

@Rule public TemporaryFolder localRepository = new TemporaryFolder();
@TempDir
public Path localRepository;

@Rule public TemporaryFolder secondLocalRepository = new TemporaryFolder();
@TempDir
public Path secondLocalRepository;

protected Git localRepositoryGit;

protected Git secondLocalRepositoryGit;

protected T gitProvider;

@Before
@BeforeEach
public void setup() throws Exception {

createRemoteRepository();
Expand All @@ -65,7 +68,7 @@ public void setup() throws Exception {
extraSetup();
}

@After
@AfterEach
public void tearDown() throws Exception {
if (localRepositoryGit != null) {
localRepositoryGit.close();
Expand Down Expand Up @@ -122,30 +125,30 @@ public void shouldBe1AheadAnd1Behind() throws Exception {
}

protected void createLocalCommit() throws Exception {
File newFile = localRepository.newFile();
File newFile = localRepository.toFile();
localRepositoryGit.add().addFilepattern(newFile.getName()).call();
localRepositoryGit.commit().setMessage("ahead").call();
}

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

File newFile = secondLocalRepository.newFile();
File newFile = secondLocalRepository.toFile();
secondLocalRepositoryGit.add().addFilepattern(newFile.getName()).call();
secondLocalRepositoryGit.commit().setMessage("behind").call();

secondLocalRepositoryGit.push().call();
}

protected void createRemoteRepository() throws Exception {
Git.init().setBare(true).setDirectory(remoteRepository.getRoot()).call();
Git.init().setBare(true).setDirectory(remoteRepository.toFile()).call();
}

protected void setupLocalRepository() throws Exception {
localRepositoryGit =
Git.cloneRepository()
.setURI(remoteRepository.getRoot().toURI().toString())
.setDirectory(localRepository.getRoot())
.setURI(remoteRepository.toFile().toURI().toString())
.setDirectory(localRepository.toFile())
.setBranch("master")
.call();

Expand All @@ -158,14 +161,14 @@ protected void setupLocalRepository() throws Exception {
protected void setupSecondLocalRepository() throws Exception {
secondLocalRepositoryGit =
Git.cloneRepository()
.setURI(remoteRepository.getRoot().toURI().toString())
.setDirectory(secondLocalRepository.getRoot())
.setURI(remoteRepository.toFile().toURI().toString())
.setDirectory(secondLocalRepository.toFile())
.setBranch("master")
.call();
}

protected void createAndPushInitialCommit() throws Exception {
File newFile = localRepository.newFile();
File newFile = localRepository.toFile();
localRepositoryGit.add().addFilepattern(newFile.getName()).call();
localRepositoryGit.commit().setMessage("initial").call();

Expand Down
8 changes: 1 addition & 7 deletions src/test/java/pl/project13/maven/git/BigDiffTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@

package pl.project13.maven.git;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.FileOutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;
import junitparams.JUnitParamsRunner;
import org.apache.maven.project.MavenProject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import pl.project13.core.git.GitDescribeConfig;

/**
Expand All @@ -38,7 +33,6 @@
*
* @author eternach
*/
@RunWith(JUnitParamsRunner.class)
public class BigDiffTest extends GitIntegrationTest {

@Test
Expand Down
Loading

0 comments on commit 95deae6

Please sign in to comment.