diff --git a/pom.xml b/pom.xml
index e93b9e59..76209763 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,6 +43,7 @@
3.6.3
2.0.13
+ 5.10.2
snapshot
release
Stable
@@ -164,9 +165,15 @@
- junit
- junit
- 4.13.2
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit-jupiter.version}
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+ ${junit-jupiter.version}
test
diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java b/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java
index c54f39ad..87701bd3 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/engine/TestClasspathJar.java
@@ -18,38 +18,42 @@
import static org.assertj.core.api.Assertions.assertThat;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.util.Arrays;
+import java.nio.file.Path;
+import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import ch.ivyteam.ivy.maven.util.ClasspathJar;
-public class TestClasspathJar {
+class TestClasspathJar {
+
+ @TempDir
+ Path tempDir;
@Test
- public void readWriteClasspath() throws IOException {
- File jarFile = Files.createTempFile("my", ".jar").toFile();
- ClasspathJar jar = new ClasspathJar(jarFile);
- File content = Files.createTempFile("content", ".jar").toFile();
- jar.createFileEntries(Arrays.asList(content));
-
- assertThat(jar.getClasspathFiles()).contains(content.getName());
-
- ZipInputStream jarStream = new ZipInputStream(new FileInputStream(jarFile));
- ZipEntry first = jarStream.getNextEntry();
- assertThat(first.getName()).isEqualTo("META-INF/MANIFEST.MF");
- String manifest = IOUtils.toString(jarStream, StandardCharsets.UTF_8);
- assertThat(manifest)
- .as("Manifest should not start with a whitespace or it will not be interpreted by the JVM")
- .startsWith("Manifest-Version:");
+ void readWriteClasspath() throws IOException {
+ var jarFile = tempDir.resolve("my.jar");
+ Files.createFile(jarFile);
+ ClasspathJar jar = new ClasspathJar(jarFile.toFile());
+ var content = tempDir.resolve("content.jar");
+ Files.createFile(content);
+ jar.createFileEntries(List.of(content.toFile()));
+
+ assertThat(jar.getClasspathFiles()).contains(content.getFileName().toString());
+
+ try (var in = new ZipInputStream(Files.newInputStream(jarFile))) {
+ ZipEntry first = in.getNextEntry();
+ assertThat(first.getName()).isEqualTo("META-INF/MANIFEST.MF");
+ String manifest = new String(in.readAllBytes(), StandardCharsets.UTF_8);
+ assertThat(manifest)
+ .as("Manifest should not start with a whitespace or it will not be interpreted by the JVM")
+ .startsWith("Manifest-Version:");
+ }
}
-
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java b/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java
index 360f7a9e..ca73b89b 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/engine/TestEngineVersionEvaluator.java
@@ -2,39 +2,29 @@
import static org.assertj.core.api.Assertions.assertThat;
-import java.io.File;
+import java.io.IOException;
import java.nio.file.Files;
-import java.util.UUID;
+import java.nio.file.Path;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import ch.ivyteam.ivy.maven.engine.EngineClassLoaderFactory.OsgiDir;
-public class TestEngineVersionEvaluator {
+class TestEngineVersionEvaluator {
- @Test
- public void isOSGiEngine_invalid() {
- File tempDir = createTempDir();
- assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir)).isFalse();
- }
+ @TempDir
+ Path tempDir;
@Test
- public void isOSGiEngine_valid() {
- File tempDir = createTempDir();
- File systemDir = new File(tempDir, OsgiDir.INSTALL_AREA);
- systemDir.mkdir();
- systemDir.deleteOnExit();
- assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir)).isTrue();
+ void isOSGiEngine_invalid() {
+ assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir.toFile())).isFalse();
}
- private static File createTempDir() {
- try {
- File tmpDir = Files.createTempDirectory(UUID.randomUUID().toString()).toFile();
- tmpDir.deleteOnExit();
- return tmpDir;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ @Test
+ void isOSGiEngine_valid() throws IOException {
+ var systemDir = tempDir.resolve(OsgiDir.INSTALL_AREA);
+ Files.createDirectories(systemDir);
+ assertThat(EngineVersionEvaluator.isOSGiEngine(tempDir.toFile())).isTrue();
}
-
}
diff --git a/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/TestYamlOptionsFactory.java b/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/TestYamlOptionsFactory.java
index a89f01a7..7eb4f8af 100644
--- a/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/TestYamlOptionsFactory.java
+++ b/src/test/java/ch/ivyteam/ivy/maven/engine/deploy/TestYamlOptionsFactory.java
@@ -3,18 +3,17 @@
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import ch.ivyteam.ivy.maven.deploy.DeployToEngineMojo;
import ch.ivyteam.ivy.maven.deploy.DeployToEngineMojo.DefaultDeployOptions;
-public class TestYamlOptionsFactory {
+class TestYamlOptionsFactory {
+
@Test
- public void yamlWithAllNonDefaultOptions() throws Exception {
+ void yamlWithAllNonDefaultOptions() throws Exception {
DeployToEngineMojo config = new DeployToEngineMojo();
config.deployTestUsers = "true";
config.deployTargetVersion = "RELEASED";
@@ -26,13 +25,13 @@ public void yamlWithAllNonDefaultOptions() throws Exception {
}
private String getFileContent(String file) throws IOException {
- try (InputStream is = getClass().getResourceAsStream(file)) {
- return IOUtils.toString(is, StandardCharsets.UTF_8);
+ try (var in = getClass().getResourceAsStream(file)) {
+ return new String(in.readAllBytes(), StandardCharsets.UTF_8);
}
}
@Test
- public void yamlWithAllDefaultOptions() throws Exception {
+ void yamlWithAllDefaultOptions() throws Exception {
DeployToEngineMojo config = new DeployToEngineMojo();
config.deployTestUsers = DefaultDeployOptions.DEPLOY_TEST_USERS;
config.deployTargetVersion = DefaultDeployOptions.VERSION_AUTO;