You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2024/04/29 15:25:46 UTC

(maven-invoker-plugin) 01/01: [MINVOKER-284] Switch to JUnit5, drop maven-compat

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch MINVOKER-284
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit c706f584e4d8417ec7474c5c95fd62cdd37f27b1
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Apr 29 17:24:58 2024 +0200

    [MINVOKER-284] Switch to JUnit5, drop maven-compat
---
 pom.xml                                            |  25 ++---
 src/it/exec-timeout-invoker-level/pom.xml          |  11 +++
 src/it/exec-timeout-mojo-level/pom.xml             |  11 +++
 .../maven/plugins/invoker/AbstractInvokerMojo.java |  17 ++--
 .../maven/plugins/invoker/InvokerReport.java       |   4 +-
 .../maven/plugins/invoker/InvokerSession.java      |   4 +-
 .../org/apache/maven/plugins/invoker/PomUtils.java |   4 +-
 .../apache/maven/plugins/invoker/VerifyMojo.java   |   4 +-
 ...MavenProjectStub.java => AbstractTestUtil.java} |  31 ++----
 .../maven/plugins/invoker/InterpolationTest.java   |  86 ++++++++--------
 .../maven/plugins/invoker/InvokerMojoTest.java     |  39 +++++---
 .../plugins/invoker/InvokerPropertiesTest.java     |  62 ++++++------
 .../maven/plugins/invoker/InvokerSessionTest.java  |   6 +-
 .../maven/plugins/invoker/JobExecutorTest.java     |  10 +-
 .../apache/maven/plugins/invoker/SelectorTest.java |  26 ++---
 .../maven/plugins/invoker/SelectorUtilsTest.java   | 109 +++++++++++----------
 16 files changed, 231 insertions(+), 218 deletions(-)

diff --git a/pom.xml b/pom.xml
index 234ad90..6b6ab53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -252,33 +252,20 @@ under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
-      <version>4.10.0</version>
+      <version>4.11.0</version>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven.plugin-testing</groupId>
-      <artifactId>maven-plugin-testing-harness</artifactId>
-      <version>3.3.0</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.codehaus.plexus</groupId>
-          <artifactId>plexus-container-default</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-compat</artifactId>
-      <version>${mavenVersion}</version>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-junit-jupiter</artifactId>
+      <version>4.11.0</version>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/src/it/exec-timeout-invoker-level/pom.xml b/src/it/exec-timeout-invoker-level/pom.xml
index 441d9aa..352ba16 100644
--- a/src/it/exec-timeout-invoker-level/pom.xml
+++ b/src/it/exec-timeout-invoker-level/pom.xml
@@ -36,6 +36,17 @@ under the License.
   </dependencies>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <configuration>
+            <goalPrefix>test</goalPrefix>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/src/it/exec-timeout-mojo-level/pom.xml b/src/it/exec-timeout-mojo-level/pom.xml
index e9a1f5e..1ff964e 100644
--- a/src/it/exec-timeout-mojo-level/pom.xml
+++ b/src/it/exec-timeout-mojo-level/pom.xml
@@ -36,6 +36,17 @@ under the License.
   </dependencies>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <configuration>
+            <goalPrefix>test</goalPrefix>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
index 14ddb73..580b2a3 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -28,6 +28,7 @@ import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
+import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -91,13 +92,13 @@ import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.InterpolationFilterReader;
-import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.ReflectionUtils;
-import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 import org.codehaus.plexus.util.cli.StreamConsumer;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
+import org.codehaus.plexus.util.xml.XmlStreamWriter;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 import org.codehaus.plexus.util.xml.Xpp3DomWriter;
 
@@ -750,9 +751,10 @@ public abstract class AbstractInvokerMojo extends AbstractMojo {
             return;
         }
 
+
         if (encoding == null || encoding.isEmpty()) {
-            getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
-                    + ", i.e. build is platform dependent!");
+            getLog().warn("File encoding has not been set, using platform encoding "
+                    + Charset.defaultCharset().displayName() + ", i.e. build is platform dependent!");
         }
 
         // done it here to prevent issues with concurrent access in case of parallel run
@@ -1522,7 +1524,7 @@ public abstract class AbstractInvokerMojo extends AbstractMojo {
         File interpolatedPomFile = interpolatePomFile(pomFile, basedir);
         // FIXME: Think about the following code part -- ^^^^^^^ END
 
-        getLog().info(buffer().a("Building: ").strong(buildJob.getProject()).toString());
+        getLog().info(buffer().a("Building: ").strong(buildJob.getProject()).build());
 
         InvokerProperties invokerProperties = getInvokerProperties(basedir, globalInvokerProperties);
 
@@ -2274,13 +2276,12 @@ public abstract class AbstractInvokerMojo extends AbstractMojo {
 
             // interpolation with token @...@
             try (Reader reader =
-                    new InterpolationFilterReader(ReaderFactory.newXmlReader(originalFile), composite, "@", "@")) {
+                    new InterpolationFilterReader(new XmlStreamReader(originalFile), composite, "@", "@")) {
                 xml = IOUtil.toString(reader);
             }
 
-            try (Writer writer = WriterFactory.newXmlWriter(interpolatedFile)) {
+            try (Writer writer = new XmlStreamWriter(interpolatedFile)) {
                 interpolatedFile.getParentFile().mkdirs();
-
                 writer.write(xml);
             }
         } catch (IOException e) {
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
index 339705a..b3adabf 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
@@ -32,7 +32,6 @@ import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader;
 import org.apache.maven.reporting.AbstractMavenReport;
 import org.apache.maven.reporting.MavenReportException;
 import org.codehaus.plexus.i18n.I18N;
-import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.xml.XmlStreamReader;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
@@ -64,7 +63,7 @@ public class InvokerReport extends AbstractMavenReport {
         BuildJobXpp3Reader buildJobReader = new BuildJobXpp3Reader();
         List<BuildJob> buildJobs = new ArrayList<>(reportFiles.length);
         for (File reportFile : reportFiles) {
-            try (XmlStreamReader xmlReader = ReaderFactory.newXmlReader(reportFile)) {
+            try (XmlStreamReader xmlReader = new XmlStreamReader(reportFile)) {
                 buildJobs.add(buildJobReader.read(xmlReader));
             } catch (XmlPullParserException e) {
                 throw new MavenReportException("Failed to parse report file: " + reportFile, e);
@@ -103,6 +102,7 @@ public class InvokerReport extends AbstractMavenReport {
         return ReportUtils.getReportFiles(reportsDirectory);
     }
 
+    @Override
     public boolean canGenerateReport() {
         return getReportFiles().length > 0;
     }
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
index 9f47c1e..a666744 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
@@ -27,7 +27,7 @@ import java.util.List;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugins.invoker.model.BuildJob;
-import org.apache.maven.shared.utils.io.IOUtil;
+import org.codehaus.plexus.util.IOUtil;
 
 import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
@@ -38,7 +38,7 @@ import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
  */
 class InvokerSession {
     private static final String SEPARATOR =
-            buffer().strong("-------------------------------------------------").toString();
+            buffer().strong("-------------------------------------------------").build();
 
     private List<BuildJob> buildJobs;
 
diff --git a/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java b/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java
index 17965c9..526ed7d 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java
@@ -25,7 +25,7 @@ import java.io.Reader;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 /**
@@ -43,7 +43,7 @@ class PomUtils {
      * @throws MojoExecutionException If the POM file could not be loaded.
      */
     public static Model loadPom(File pomFile) throws MojoExecutionException {
-        try (Reader reader = ReaderFactory.newXmlReader(pomFile)) {
+        try (Reader reader = new XmlStreamReader(pomFile)) {
             return new MavenXpp3Reader().read(reader, false);
         } catch (XmlPullParserException e) {
             throw new MojoExecutionException("Failed to parse POM: " + pomFile, e);
diff --git a/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java b/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java
index 9bd6d82..b3a21cb 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java
@@ -29,7 +29,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader;
-import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 /**
@@ -117,7 +117,7 @@ public class VerifyMojo extends AbstractMojo {
         InvokerSession invokerSession = new InvokerSession();
 
         for (File reportFile : reportFiles) {
-            try (Reader xmlReader = ReaderFactory.newXmlReader(reportFile)) {
+            try (Reader xmlReader = new XmlStreamReader(reportFile)) {
                 invokerSession.addJob(reader.read(xmlReader));
             } catch (XmlPullParserException e) {
                 throw new MojoExecutionException("Failed to parse report file: " + reportFile, e);
diff --git a/src/test/java/org/apache/maven/plugins/invoker/ExtendedMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/invoker/AbstractTestUtil.java
similarity index 59%
rename from src/test/java/org/apache/maven/plugins/invoker/ExtendedMavenProjectStub.java
rename to src/test/java/org/apache/maven/plugins/invoker/AbstractTestUtil.java
index b8e5f9d..2a2f791 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/ExtendedMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/AbstractTestUtil.java
@@ -18,33 +18,18 @@
  */
 package org.apache.maven.plugins.invoker;
 
-import java.util.Properties;
+import java.io.File;
 
-import org.apache.maven.model.Scm;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.codehaus.plexus.util.ReflectionUtils;
 
-/**
- * @author Olivier Lamy
- * @since 22 nov. 07
- */
-public class ExtendedMavenProjectStub extends MavenProjectStub {
-    private Scm scm;
-
-    private Properties properties;
-
-    public Scm getScm() {
-        return scm;
-    }
-
-    public void setScm(Scm scm) {
-        this.scm = scm;
-    }
+abstract class AbstractTestUtil {
 
-    public Properties getProperties() {
-        return properties;
+    protected String getBasedir() {
+        String path = System.getProperty("basedir");
+        return path != null ? path : new File("").getAbsolutePath();
     }
 
-    public void setProperties(Properties properties) {
-        this.properties = properties;
+    protected void setVariableValueToObject(Object object, String filed, Object value) throws IllegalAccessException {
+        ReflectionUtils.setVariableValueInObject(object, filed, value);
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java b/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java
index 637845d..8385011 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java
@@ -20,80 +20,80 @@ package org.apache.maven.plugins.invoker;
 
 import java.io.File;
 import java.io.Reader;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
 import org.apache.maven.model.Scm;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
 import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author Olivier Lamy
  * @since 22 nov. 07
  */
-public class InterpolationTest extends AbstractMojoTestCase {
+class InterpolationTest extends AbstractTestUtil {
 
-    protected MavenProjectStub buildMavenProjectStub() {
-        ExtendedMavenProjectStub project = new ExtendedMavenProjectStub();
+    private MavenProject buildMavenProjectStub() {
+        MavenProject project = new MavenProject();
         project.setVersion("1.0-SNAPSHOT");
         project.setArtifactId("foo");
         project.setGroupId("bar");
+        project.setFile(new File(getBasedir(), "pom.xml"));
         Properties properties = new Properties();
         properties.put("fooOnProject", "barOnProject");
-        project.setProperties(properties);
+        project.getModel().setProperties(properties);
         Scm scm = new Scm();
         scm.setConnection("http://blabla");
         project.setScm(scm);
         return project;
     }
 
-    public void testCompositeMap() {
+    @Test
+    void testCompositeMap() {
 
-        Properties properties = new Properties();
+        Map<String, Object> properties = new HashMap<>();
         properties.put("foo", "bar");
         properties.put("version", "2.0-SNAPSHOT");
-        CompositeMap compositeMap = new CompositeMap(buildMavenProjectStub(), (Map) properties, false);
-        assertEquals("1.0-SNAPSHOT", compositeMap.get("pom.version"));
-        assertEquals("bar", compositeMap.get("foo"));
-        assertEquals("bar", compositeMap.get("pom.groupId"));
-        assertEquals("http://blabla", compositeMap.get("pom.scm.connection"));
-        assertEquals("barOnProject", compositeMap.get("fooOnProject"));
+        CompositeMap compositeMap = new CompositeMap(buildMavenProjectStub(), properties, false);
+        assertThat(compositeMap).containsEntry("pom.version", "1.0-SNAPSHOT");
+        assertThat(compositeMap).containsEntry("foo", "bar");
+        assertThat(compositeMap).containsEntry("pom.groupId", "bar");
+        assertThat(compositeMap).containsEntry("pom.scm.connection", "http://blabla");
+        assertThat(compositeMap).containsEntry("fooOnProject", "barOnProject");
     }
 
-    public void testPomInterpolation() throws Exception {
-        Reader reader = null;
+    @Test
+    void testPomInterpolation() throws Exception {
         File interpolatedPomFile;
-        try {
-            InvokerMojo invokerMojo = new InvokerMojo();
-            setVariableValueToObject(invokerMojo, "project", buildMavenProjectStub());
-            setVariableValueToObject(invokerMojo, "settings", new Settings());
-            Properties properties = new Properties();
-            properties.put("foo", "bar");
-            properties.put("version", "2.0-SNAPSHOT");
-            setVariableValueToObject(invokerMojo, "filterProperties", properties);
-            String dirPath =
-                    getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
-                            + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation";
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject(invokerMojo, "project", buildMavenProjectStub());
+        setVariableValueToObject(invokerMojo, "settings", new Settings());
+        Properties properties = new Properties();
+        properties.put("foo", "bar");
+        properties.put("version", "2.0-SNAPSHOT");
+        setVariableValueToObject(invokerMojo, "filterProperties", properties);
+        String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
+                + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation";
 
-            interpolatedPomFile = new File(getBasedir(), "target/interpolated-pom.xml");
-            invokerMojo.buildInterpolatedFile(new File(dirPath, "pom.xml"), interpolatedPomFile);
-            reader = ReaderFactory.newXmlReader(interpolatedPomFile);
+        interpolatedPomFile = new File(getBasedir(), "target/interpolated-pom.xml");
+        invokerMojo.buildInterpolatedFile(new File(dirPath, "pom.xml"), interpolatedPomFile);
+        try (Reader reader = new XmlStreamReader(interpolatedPomFile)) {
+            String content = IOUtil.toString(reader);
+            assertThat(content.indexOf("<interpolateValue>bar</interpolateValue>"))
+                    .isPositive();
+        }
+        // recreate it to test delete if exists before creation
+        invokerMojo.buildInterpolatedFile(new File(dirPath, "pom.xml"), interpolatedPomFile);
+        try (Reader reader = new XmlStreamReader(interpolatedPomFile)) {
             String content = IOUtil.toString(reader);
-            assertTrue(content.indexOf("<interpolateValue>bar</interpolateValue>") > 0);
-            reader.close();
-            reader = null;
-            // recreate it to test delete if exists before creation
-            invokerMojo.buildInterpolatedFile(new File(dirPath, "pom.xml"), interpolatedPomFile);
-            reader = ReaderFactory.newXmlReader(interpolatedPomFile);
-            content = IOUtil.toString(reader);
-            assertTrue(content.indexOf("<interpolateValue>bar</interpolateValue>") > 0);
-            reader.close();
-            reader = null;
-        } finally {
-            IOUtil.close(reader);
+            assertThat(content.indexOf("<interpolateValue>bar</interpolateValue>"))
+                    .isPositive();
         }
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java b/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java
index 49abbeb..d57a587 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java
@@ -22,10 +22,10 @@ import java.io.File;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugins.invoker.model.BuildJob;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
  * @author Olivier Lamy
  * @since 18 nov. 07
  */
-public class InvokerMojoTest extends AbstractMojoTestCase {
+class InvokerMojoTest extends AbstractTestUtil {
 
     private static final String DUMMY_PROJECT = "dummy" + File.separator + "pom.xml";
     private static final String WITH_POM_DIR_PROJECT = "with-pom-project-dir" + File.separator + "pom.xml";
@@ -46,7 +46,8 @@ public class InvokerMojoTest extends AbstractMojoTestCase {
         return mavenProject;
     }
 
-    public void testSingleInvokerTest() throws Exception {
+    @Test
+    void testSingleInvokerTest() throws Exception {
         // given
         InvokerMojo invokerMojo = new InvokerMojo();
         String dirPath = getBasedir() + "/src/test/resources/unit";
@@ -63,7 +64,8 @@ public class InvokerMojoTest extends AbstractMojoTestCase {
         assertThat(jobs).map(BuildJob::getProject).containsExactlyInAnyOrder(DUMMY_PROJECT);
     }
 
-    public void testMultiInvokerTest() throws Exception {
+    @Test
+    void testMultiInvokerTest() throws Exception {
         // given
         InvokerMojo invokerMojo = new InvokerMojo();
         String dirPath = getBasedir() + "/src/test/resources/unit";
@@ -80,7 +82,8 @@ public class InvokerMojoTest extends AbstractMojoTestCase {
         assertThat(jobs).map(BuildJob::getProject).containsExactlyInAnyOrder(DUMMY_PROJECT, INTERPOLATION_PROJECT);
     }
 
-    public void testFullPatternInvokerTest() throws Exception {
+    @Test
+    void testFullPatternInvokerTest() throws Exception {
         // given
         InvokerMojo invokerMojo = new InvokerMojo();
         String dirPath = getBasedir() + "/src/test/resources/unit";
@@ -100,7 +103,8 @@ public class InvokerMojoTest extends AbstractMojoTestCase {
                         DUMMY_PROJECT, WITH_POM_DIR_PROJECT, WITHOUT_POM_PROJECT, INTERPOLATION_PROJECT);
     }
 
-    public void testSetupInProjectList() throws Exception {
+    @Test
+    void testSetupInProjectList() throws Exception {
         // given
         InvokerMojo invokerMojo = new InvokerMojo();
         String dirPath = getBasedir() + "/src/test/resources/unit";
@@ -127,7 +131,8 @@ public class InvokerMojoTest extends AbstractMojoTestCase {
                 .containsExactlyInAnyOrder(DUMMY_PROJECT);
     }
 
-    public void testSetupProjectIsFiltered() throws Exception {
+    @Test
+    void testSetupProjectIsFiltered() throws Exception {
         // given
         InvokerMojo invokerMojo = new InvokerMojo();
         String dirPath = getBasedir() + "/src/test/resources/unit";
@@ -152,14 +157,20 @@ public class InvokerMojoTest extends AbstractMojoTestCase {
                 .isEmpty();
     }
 
-    public void testAlreadyCloned() {
-        assertFalse(AbstractInvokerMojo.alreadyCloned("dir", Collections.emptyList()));
-        assertTrue(AbstractInvokerMojo.alreadyCloned("dir", Collections.singletonList("dir")));
-        assertTrue(AbstractInvokerMojo.alreadyCloned("dir" + File.separator + "sub", Collections.singletonList("dir")));
-        assertFalse(AbstractInvokerMojo.alreadyCloned("dirs", Collections.singletonList("dir")));
+    @Test
+    void testAlreadyCloned() {
+        assertThat(AbstractInvokerMojo.alreadyCloned("dir", Collections.emptyList()))
+                .isFalse();
+        assertThat(AbstractInvokerMojo.alreadyCloned("dir", Collections.singletonList("dir")))
+                .isTrue();
+        assertThat(AbstractInvokerMojo.alreadyCloned("dir" + File.separator + "sub", Collections.singletonList("dir")))
+                .isTrue();
+        assertThat(AbstractInvokerMojo.alreadyCloned("dirs", Collections.singletonList("dir")))
+                .isFalse();
     }
 
-    public void testParallelThreadsSettings() throws IllegalAccessException {
+    @Test
+    void testParallelThreadsSettings() throws Exception {
         Object[][] testValues = {
             {"4", 4},
             {"1C", Runtime.getRuntime().availableProcessors()},
@@ -174,7 +185,7 @@ public class InvokerMojoTest extends AbstractMojoTestCase {
 
             setVariableValueToObject(invokerMojo, "parallelThreads", parallelThreads);
 
-            assertEquals(expectedParallelThreads, invokerMojo.getParallelThreadsCount());
+            assertThat(expectedParallelThreads).isEqualTo(invokerMojo.getParallelThreadsCount());
         }
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
index 8db6c39..26a706e 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
@@ -27,10 +27,10 @@ import java.util.Properties;
 
 import org.apache.maven.shared.invoker.InvocationRequest;
 import org.apache.maven.shared.invoker.InvocationRequest.ReactorFailureBehavior;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
@@ -48,20 +48,20 @@ import static org.mockito.Mockito.when;
  *
  * @author Benjamin Bentmann
  */
-@RunWith(MockitoJUnitRunner.class)
-public class InvokerPropertiesTest {
+@ExtendWith(MockitoExtension.class)
+class InvokerPropertiesTest {
 
     @Mock
     private InvocationRequest request;
 
     @Test
-    public void testConstructorNullSafe() {
+    void testConstructorNullSafe() {
         InvokerProperties facade = new InvokerProperties(null);
         assertThat(facade.getProperties()).isNotNull();
     }
 
     @Test
-    public void testGetInvokerProperty() {
+    void testGetInvokerProperty() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -76,7 +76,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testGetJobName() {
+    void testGetJobName() {
         Properties props = new Properties();
         final String jobName = "Build Job name";
         props.put("invoker.name", jobName);
@@ -86,7 +86,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testIsExpectedResult() {
+    void testIsExpectedResult() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -103,7 +103,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestEmptyProperties() {
+    void testConfigureRequestEmptyProperties() {
 
         InvokerProperties facade = new InvokerProperties(null);
 
@@ -112,7 +112,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestGoals() {
+    void testConfigureRequestGoals() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -149,7 +149,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestProfiles() {
+    void testConfigureRequestProfiles() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -185,7 +185,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestProject() throws Exception {
+    void testConfigureRequestProject() throws Exception {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -211,7 +211,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestMavenExecutable() {
+    void testConfigureRequestMavenExecutable() {
         Properties props = new Properties();
 
         InvokerProperties facade = new InvokerProperties(props);
@@ -232,7 +232,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestMavenOpts() {
+    void testConfigureRequestMavenOpts() {
         Properties props = new Properties();
 
         InvokerProperties facade = new InvokerProperties(props);
@@ -252,7 +252,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestFailureBehavior() {
+    void testConfigureRequestFailureBehavior() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -264,7 +264,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestFailureBehaviorUnKnownName() {
+    void testConfigureRequestFailureBehaviorUnKnownName() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -278,7 +278,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestRecursion() {
+    void testConfigureRequestRecursion() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -295,7 +295,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestOffline() {
+    void testConfigureRequestOffline() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -312,7 +312,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestDebug() {
+    void testConfigureRequestDebug() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -343,7 +343,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestQuiet() {
+    void testConfigureRequestQuiet() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -374,7 +374,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureRequestTimeoutInSeconds() {
+    void testConfigureRequestTimeoutInSeconds() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -393,7 +393,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureEnvironmentVariables() {
+    void testConfigureEnvironmentVariables() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -411,7 +411,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureEnvironmentVariablesWithIndex() {
+    void testConfigureEnvironmentVariablesWithIndex() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -429,7 +429,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureUpdateSnapshots() {
+    void testConfigureUpdateSnapshots() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -447,7 +447,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testConfigureUpdateSnapshotsDefault() {
+    void testConfigureUpdateSnapshotsDefault() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -464,7 +464,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testIsInvocationDefined() {
+    void testIsInvocationDefined() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -486,7 +486,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testIsSelectedDefined() {
+    void testIsSelectedDefined() {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
 
@@ -508,7 +508,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testGetToolchainsForEmptyProperties() {
+    void testGetToolchainsForEmptyProperties() {
 
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties(props);
@@ -521,7 +521,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testGetToolchains() {
+    void testGetToolchains() {
         Properties props = new Properties();
         props.put("invoker.toolchain.jdk.version", "11");
         InvokerProperties facade = new InvokerProperties(props);
@@ -534,7 +534,7 @@ public class InvokerPropertiesTest {
     }
 
     @Test
-    public void testGetToolchainsWithIndex() {
+    void testGetToolchainsWithIndex() {
         Properties props = new Properties();
         props.put("selector.1.invoker.toolchain.jdk.version", "11");
         InvokerProperties facade = new InvokerProperties(props);
diff --git a/src/test/java/org/apache/maven/plugins/invoker/InvokerSessionTest.java b/src/test/java/org/apache/maven/plugins/invoker/InvokerSessionTest.java
index 6226e39..9220735 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/InvokerSessionTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/InvokerSessionTest.java
@@ -22,7 +22,7 @@ import java.util.Collections;
 
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugins.invoker.model.BuildJob;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.mock;
@@ -32,10 +32,10 @@ import static org.mockito.Mockito.verify;
 /**
  * Unittest for {@link InvokerSession}
  */
-public class InvokerSessionTest {
+class InvokerSessionTest {
 
     @Test
-    public void skipSummary() {
+    void skipSummary() {
         Log logger = mock(Log.class);
         BuildJob skippedBuildJob = new BuildJob("minvoker-279");
         skippedBuildJob.setResult(BuildJob.Result.SKIPPED);
diff --git a/src/test/java/org/apache/maven/plugins/invoker/JobExecutorTest.java b/src/test/java/org/apache/maven/plugins/invoker/JobExecutorTest.java
index de37432..9f56408 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/JobExecutorTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/JobExecutorTest.java
@@ -26,7 +26,7 @@ import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.maven.plugins.invoker.model.BuildJob;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.fail;
@@ -36,17 +36,17 @@ import static org.assertj.core.api.Assertions.fail;
  *
  * @author Slawomir Jaranowski
  */
-public class JobExecutorTest {
+class JobExecutorTest {
 
     @Test
-    public void emptyJobList() {
+    void emptyJobList() {
         JobExecutor jobExecutor = new JobExecutor(Collections.emptyList(), 1);
 
         jobExecutor.forEach(job -> fail("fail"));
     }
 
     @Test
-    public void failedJob() {
+    void failedJob() {
         BuildJob job = aJob("job1", 100);
 
         JobExecutor jobExecutor = new JobExecutor(Collections.singletonList(job), 1);
@@ -58,7 +58,7 @@ public class JobExecutorTest {
     }
 
     @Test
-    public void jobsShouldBeGroupedAndExecutedInProperOrder() {
+    void jobsShouldBeGroupedAndExecutedInProperOrder() {
         Map<Integer, AtomicInteger> jobsCounter = new HashMap<>();
         jobsCounter.put(100, new AtomicInteger(3));
         jobsCounter.put(10, new AtomicInteger(2));
diff --git a/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java b/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java
index f4a8f97..d55875c 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java
@@ -20,39 +20,39 @@ package org.apache.maven.plugins.invoker;
 
 import java.util.Properties;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Test for {@link Selector}.
  */
-public class SelectorTest {
+class SelectorTest {
     @Test
-    public void testGlobalMatch() {
+    void testGlobalMatch() {
         Selector selector = new Selector("3.2.5", "1.7", null);
 
         Properties props = new Properties();
         props.setProperty("invoker.maven.version", "3.0+");
         InvokerProperties invokerProperties = new InvokerProperties(props);
-        assertEquals(0, selector.getSelection(invokerProperties));
+        assertThat(selector.getSelection(invokerProperties)).isZero();
     }
 
     @Test
-    public void testSelectorMatch() {
+    void testSelectorMatch() {
         Selector selector = new Selector("3.2.5", "1.7", null);
 
         Properties props = new Properties();
         props.setProperty("selector.1.maven.version", "3.0+");
         InvokerProperties invokerProperties = new InvokerProperties(props);
-        assertEquals(0, selector.getSelection(invokerProperties));
+        assertThat(selector.getSelection(invokerProperties)).isZero();
 
         props.setProperty("selector.1.maven.version", "3.3.1+");
-        assertEquals(Selector.SELECTOR_MULTI, selector.getSelection(invokerProperties));
+        assertThat(selector.getSelection(invokerProperties)).isEqualTo(Selector.SELECTOR_MULTI);
     }
 
     @Test
-    public void testSelectorWithGlobalMatch() {
+    void testSelectorWithGlobalMatch() {
         Selector selector = new Selector("3.2.5", "1.7", null);
 
         Properties props = new Properties();
@@ -61,16 +61,16 @@ public class SelectorTest {
         props.setProperty("selector.1.java.version", "1.4+");
         props.setProperty("selector.2.os.family", "myos");
         InvokerProperties invokerProperties = new InvokerProperties(props);
-        assertEquals(0, selector.getSelection(invokerProperties));
+        assertThat(selector.getSelection(invokerProperties)).isZero();
 
         props.setProperty("invoker.maven.version", "3.3.1+");
-        assertEquals(Selector.SELECTOR_MULTI, selector.getSelection(invokerProperties));
+        assertThat(selector.getSelection(invokerProperties)).isEqualTo(Selector.SELECTOR_MULTI);
 
         props.setProperty("invoker.maven.version", "3.0+");
         props.setProperty("selector.1.maven.version", "3.3.1+");
-        assertEquals(Selector.SELECTOR_MULTI, selector.getSelection(invokerProperties));
+        assertThat(selector.getSelection(invokerProperties)).isEqualTo(Selector.SELECTOR_MULTI);
 
         props.setProperty("selector.2.os.family", "!myos");
-        assertEquals(0, selector.getSelection(invokerProperties));
+        assertThat(selector.getSelection(invokerProperties)).isZero();
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java b/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java
index 77f26be..8f72bfa 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java
@@ -24,18 +24,14 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.maven.plugins.invoker.AbstractInvokerMojo.ToolchainPrivateManager;
 import org.apache.maven.toolchain.ToolchainPrivate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.isA;
+import static org.mockito.ArgumentMatchers.anyMap;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -44,63 +40,69 @@ import static org.mockito.Mockito.when;
  *
  * @author Benjamin Bentmann
  */
-public class SelectorUtilsTest {
+class SelectorUtilsTest {
 
     @Test
-    public void testParseList() {
+    void testParseList() {
         List<String> includes = new ArrayList<>();
         List<String> excludes = new ArrayList<>();
 
         SelectorUtils.parseList(null, includes, excludes);
 
         SelectorUtils.parseList(" 1.5, !1.4, 1.6+ ", includes, excludes);
-        assertEquals(Arrays.asList("1.5", "1.6+"), includes);
-        assertEquals(Collections.singletonList("1.4"), excludes);
+        assertThat(includes).containsExactly("1.5", "1.6+");
+        assertThat(excludes).containsExactly("1.4");
     }
 
     @Test
-    public void testParseVersion() {
-        assertEquals(Arrays.asList(1, 6, 0, 12), SelectorUtils.parseVersion("1.6.0_12"));
-
-        assertEquals(Arrays.asList(1, 6, 0, 12), SelectorUtils.parseVersion("1.6.0_12+"));
-        assertEquals(Arrays.asList(1, 6, 0, 12), SelectorUtils.parseVersion("1.6.0_12-"));
+    void testParseVersion() {
+        assertThat(SelectorUtils.parseVersion("1.6.0_12")).containsExactly(1, 6, 0, 12);
+        assertThat(SelectorUtils.parseVersion("1.6.0_12+")).containsExactly(1, 6, 0, 12);
+        assertThat(SelectorUtils.parseVersion("1.6.0_12-")).containsExactly(1, 6, 0, 12);
     }
 
     @Test
-    public void testCompareVersions() {
-        assertTrue(SelectorUtils.compareVersions(Arrays.asList(1, 6), Arrays.asList(1, 6)) == 0);
-
-        assertTrue(SelectorUtils.compareVersions(Arrays.asList(1, 5), Arrays.asList(1, 6)) < 0);
-        assertTrue(SelectorUtils.compareVersions(Arrays.asList(1, 6), Arrays.asList(1, 5)) > 0);
-
-        assertTrue(SelectorUtils.compareVersions(Collections.singletonList(1), Arrays.asList(1, 6)) < 0);
-        assertTrue(SelectorUtils.compareVersions(Arrays.asList(1, 6), Collections.singletonList(1)) > 0);
+    void testCompareVersions() {
+        assertThat(SelectorUtils.compareVersions(Arrays.asList(1, 6), Arrays.asList(1, 6)))
+                .isZero();
+
+        assertThat(SelectorUtils.compareVersions(Arrays.asList(1, 5), Arrays.asList(1, 6)))
+                .isNegative();
+        assertThat(SelectorUtils.compareVersions(Arrays.asList(1, 6), Arrays.asList(1, 5)))
+                .isPositive();
+
+        assertThat(SelectorUtils.compareVersions(Collections.singletonList(1), Arrays.asList(1, 6)))
+                .isNegative();
+        assertThat(SelectorUtils.compareVersions(Arrays.asList(1, 6), Collections.singletonList(1)))
+                .isPositive();
     }
 
     @Test
-    public void testIsMatchingJre() {
-
-        assertFalse(SelectorUtils.isJreVersion(Arrays.asList(1, 4, 2, 8), "1.5"));
-        assertTrue(SelectorUtils.isJreVersion(Arrays.asList(1, 5), "1.5"));
-        assertTrue(SelectorUtils.isJreVersion(Arrays.asList(1, 5, 9), "1.5"));
-        assertFalse(SelectorUtils.isJreVersion(Arrays.asList(1, 6), "1.5"));
-
-        assertFalse(SelectorUtils.isJreVersion(Arrays.asList(1, 4, 2, 8), "1.5+"));
-        assertTrue(SelectorUtils.isJreVersion(Arrays.asList(1, 5), "1.5+"));
-        assertTrue(SelectorUtils.isJreVersion(Arrays.asList(1, 5, 9), "1.5+"));
-        assertTrue(SelectorUtils.isJreVersion(Arrays.asList(1, 6), "1.5+"));
-
-        assertTrue(SelectorUtils.isJreVersion(Arrays.asList(1, 4, 2, 8), "1.5-"));
-        assertFalse(SelectorUtils.isJreVersion(Arrays.asList(1, 5), "1.5-"));
-        assertFalse(SelectorUtils.isJreVersion(Arrays.asList(1, 5, 9), "1.5-"));
-        assertFalse(SelectorUtils.isJreVersion(Arrays.asList(1, 6), "1.5-"));
-
-        assertTrue(SelectorUtils.isJreVersion((String) null, "1.5"));
-        assertTrue(SelectorUtils.isJreVersion("", "1.5"));
+    void testIsMatchingJre() {
+
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 4, 2, 8), "1.5")).isFalse();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 5), "1.5")).isTrue();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 5, 9), "1.5")).isTrue();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 6), "1.5")).isFalse();
+
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 4, 2, 8), "1.5+"))
+                .isFalse();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 5), "1.5+")).isTrue();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 5, 9), "1.5+")).isTrue();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 6), "1.5+")).isTrue();
+
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 4, 2, 8), "1.5-"))
+                .isTrue();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 5), "1.5-")).isFalse();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 5, 9), "1.5-")).isFalse();
+        assertThat(SelectorUtils.isJreVersion(Arrays.asList(1, 6), "1.5-")).isFalse();
+
+        assertThat(SelectorUtils.isJreVersion((String) null, "1.5")).isTrue();
+        assertThat(SelectorUtils.isJreVersion("", "1.5")).isTrue();
     }
 
     @Test
-    public void testIsMatchingToolchain() throws Exception {
+    void testIsMatchingToolchain() throws Exception {
         InvokerToolchain openJdk9 = new InvokerToolchain("jdk");
         openJdk9.addProvides("version", "9");
         openJdk9.addProvides("vendor", "openJDK");
@@ -110,32 +112,37 @@ public class SelectorUtilsTest {
 
         ToolchainPrivateManager toolchainPrivateManager = mock(ToolchainPrivateManager.class);
         ToolchainPrivate jdkMatching = mock(ToolchainPrivate.class);
-        when(jdkMatching.matchesRequirements(isA(Map.class))).thenReturn(true);
+        when(jdkMatching.matchesRequirements(anyMap())).thenReturn(true);
         when(jdkMatching.getType()).thenReturn("jdk");
 
         ToolchainPrivate jdkMismatch = mock(ToolchainPrivate.class);
         when(jdkMismatch.getType()).thenReturn("jdk");
 
         when(toolchainPrivateManager.getToolchainPrivates("jdk")).thenReturn(new ToolchainPrivate[] {jdkMatching});
-        assertTrue(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)));
+        assertThat(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)))
+                .isTrue();
 
         when(toolchainPrivateManager.getToolchainPrivates("jdk")).thenReturn(new ToolchainPrivate[] {jdkMismatch});
-        assertFalse(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)));
+        assertThat(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)))
+                .isFalse();
 
         when(toolchainPrivateManager.getToolchainPrivates("jdk"))
                 .thenReturn(new ToolchainPrivate[] {jdkMatching, jdkMismatch, jdkMatching});
-        assertTrue(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)));
+        assertThat(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)))
+                .isTrue();
 
         when(toolchainPrivateManager.getToolchainPrivates("jdk")).thenReturn(new ToolchainPrivate[0]);
-        assertFalse(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)));
+        assertThat(SelectorUtils.isToolchain(toolchainPrivateManager, Collections.singleton(openJdk9)))
+                .isFalse();
 
         when(toolchainPrivateManager.getToolchainPrivates("jdk")).thenReturn(new ToolchainPrivate[] {jdkMatching});
         when(toolchainPrivateManager.getToolchainPrivates("maven")).thenReturn(new ToolchainPrivate[0]);
-        assertFalse(SelectorUtils.isToolchain(toolchainPrivateManager, Arrays.asList(openJdk9, maven360)));
+        assertThat(SelectorUtils.isToolchain(toolchainPrivateManager, Arrays.asList(openJdk9, maven360)))
+                .isFalse();
     }
 
     @Test
-    public void mavenVersionForNotExistingMavenHomeThrowException() {
+    void mavenVersionForNotExistingMavenHomeThrowException() {
         File mavenHome = new File("not-existing-path");
 
         assertThatCode(() -> SelectorUtils.getMavenVersion(mavenHome))
@@ -144,7 +151,7 @@ public class SelectorUtilsTest {
     }
 
     @Test
-    public void mavenVersionFromMavenHome() throws IOException {
+    void mavenVersionFromMavenHome() throws IOException {
         File mavenHome = new File(System.getProperty("maven.home"));
 
         String mavenVersion = SelectorUtils.getMavenVersion(mavenHome);