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 2026/01/18 08:00:00 UTC

(maven-dependency-plugin) branch master updated: Migration to JUnit 5 - avoid using AbstractMojoTestCase (#1574)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4e021c0c Migration to JUnit 5 - avoid using AbstractMojoTestCase (#1574)
4e021c0c is described below

commit 4e021c0ce0d71c1f33662443b75acb0f4c083f3a
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Sun Jan 18 08:59:56 2026 +0100

    Migration to JUnit 5 - avoid using AbstractMojoTestCase (#1574)
    
    * Migration to JUnit 5 - avoid using AbstractMojoTestCase
    
    - bump plugin-testing to 3.5.0
    - cleanups after parent
---
 pom.xml                                            |  20 +-
 .../dependency/AbstractDependencyMojoTestCase.java | 127 ---
 .../maven/plugins/dependency/TestCollectMojo.java  |  62 +-
 .../maven/plugins/dependency/TestGetMojo.java      | 112 ++-
 .../plugins/dependency/TestListClassesMojo.java    |  32 +-
 .../apache/maven/plugins/dependency/TestSkip.java  |  12 +-
 .../dependency/analyze/TestAnalyzeDepMgt.java      |   7 +-
 .../analyze/TestAnalyzeDuplicateMojo.java          |  29 +-
 .../exclusion/AnalyzeExclusionsMojoTest.java       |  13 +-
 .../dependency/fromConfiguration/TestCopyMojo.java | 276 ++++---
 .../TestIncludeExcludeUnpackMojo.java              | 230 +++---
 .../fromConfiguration/TestUnpackMojo.java          | 219 ++---
 .../fromDependencies/TestBuildClasspathMojo.java   |   6 +-
 .../fromDependencies/TestCopyDependenciesMojo.java | 279 ++++---
 .../TestCopyDependenciesMojo2.java                 | 174 ++--
 .../TestIncludeExcludeUnpackDependenciesMojo.java  | 159 ++--
 .../TestRenderDependenciesMojo.java                |  62 +-
 .../TestUnpackDependenciesMojo.java                | 312 ++++----
 .../TestUnpackDependenciesMojo2.java               | 104 +--
 .../resolvers/ResolveDependenciesMojoTest.java     |  35 +-
 .../dependency/resolvers/TestResolveMojo.java      |  56 +-
 .../testUtils/stubs/DependencyProjectStub.java     | 881 ---------------------
 .../dependency/testUtils/stubs/StubMarkerFile.java |  14 +-
 .../plugins/dependency/tree/TestTreeMojo.java      | 176 ++--
 .../dependency/utils/TestDependencyUtil.java       |   2 +-
 .../utils/filters/TestDestFileFilter.java          |  18 +-
 .../utils/filters/TestMarkerFileFilter.java        |   2 +-
 .../utils/filters/TestResolveMarkerFileFilter.java |   2 +-
 .../markers/TestDefaultMarkerFileHandler.java      |   2 +-
 .../markers/TestSourcesMarkerFileHandler.java      |  32 +-
 .../translators/TestClassifierTypeTranslator.java  |  61 +-
 .../resources/unit/collect-test/plugin-config.xml  |  37 -
 .../unit/copy-dependencies-test/plugin-config.xml  |  31 -
 .../resources/unit/copy-test/plugin-config.xml     |  37 -
 src/test/resources/unit/get-test/plugin-config.xml |  40 -
 .../render-dependencies-test/plugin-config.xml     |  37 -
 .../resources/unit/resolve-test/plugin-config.xml  |  37 -
 .../resources/unit/tree-test/plugin-config.xml     |  37 -
 .../unpack-dependencies-test/plugin-config.xml     |  31 -
 .../resources/unit/unpack-test/plugin-config.xml   |  37 -
 40 files changed, 1263 insertions(+), 2577 deletions(-)

diff --git a/pom.xml b/pom.xml
index 44d8fcc8..4c752f7d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,7 +97,7 @@ under the License.
     <jettyVersion>9.4.58.v20250814</jettyVersion>
     <mockito.version>4.11.0</mockito.version>
     <plexus-archiver.version>4.11.0</plexus-archiver.version>
-    <pluginTestingVersion>3.4.0</pluginTestingVersion>
+    <pluginTestingVersion>3.5.0</pluginTestingVersion>
 
     <!-- strict check by dependency:analyze-only -->
     <enforce.dependency.declarations>true</enforce.dependency.declarations>
@@ -179,12 +179,6 @@ under the License.
       <artifactId>commons-lang3</artifactId>
       <version>3.20.0</version>
     </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.21.0</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
@@ -327,18 +321,6 @@ under the License.
       <version>2.0.1</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <!-- support for JUnit 4 -->
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
diff --git a/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java b/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
deleted file mode 100644
index 7e100677..00000000
--- a/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.dependency;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.LegacySupport;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
-import org.apache.maven.plugins.dependency.utils.CopyUtil;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.LocalRepositoryManager;
-import org.sonatype.plexus.build.incremental.DefaultBuildContext;
-
-public abstract class AbstractDependencyMojoTestCase extends AbstractMojoTestCase {
-
-    protected File testDir;
-
-    protected DependencyArtifactStubFactory stubFactory;
-
-    /**
-     * Initializes the test environment by creating a temporary directory and setting up the stub factory.
-     * Subclasses must call super.setUp() in their own setUp method to ensure proper initialization.
-     * To customize the test directory name, file creation, or path structure, override getTestDirectoryName(),
-     * shouldCreateFiles(), and shouldUseFlattenedPath() respectively.
-     *
-     * @throws Exception if setup fails
-     */
-    protected void setUp() throws Exception {
-        // Required for mojo lookups to work
-        super.setUp();
-
-        testDir = Files.createTempDirectory(getTestDirectoryName()).toFile();
-        testDir.deleteOnExit();
-
-        stubFactory = new DependencyArtifactStubFactory(testDir, shouldCreateFiles(), shouldUseFlattenedPath());
-    }
-
-    /**
-     * Returns the name of the temporary test directory. Subclasses can override to customize.
-     *
-     * @return the test directory name
-     */
-    protected String getTestDirectoryName() {
-        return "test-dir";
-    }
-
-    /**
-     * Determines whether files should be created by the stub factory. Subclasses can override to customize.
-     *
-     * @return true if files should be created, false otherwise
-     */
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
-
-    /**
-     * Determines whether the stub factory should use flattened paths. Subclasses can override to customize.
-     *
-     * @return true if flattened paths should be used, false otherwise
-     */
-    protected boolean shouldUseFlattenedPath() {
-        return true;
-    }
-
-    /**
-     * Cleans up the test environment by deleting the temporary directory.
-     * Subclasses must call super.tearDown() in their own tearDown method to ensure proper cleanup.
-     *
-     * @throws Exception if cleanup fails
-     */
-    @Override
-    protected void tearDown() throws Exception {
-        if (testDir != null) {
-            FileUtils.deleteDirectory(testDir);
-            assertFalse("Test directory should not exist after cleanup", testDir.exists());
-        }
-        super.tearDown();
-    }
-
-    protected void copyArtifactFile(Artifact sourceArtifact, File destFile) throws MojoExecutionException, IOException {
-        new CopyUtil(new DefaultBuildContext()).copyArtifactFile(sourceArtifact, destFile);
-    }
-
-    protected void installLocalRepository(LegacySupport legacySupport) throws ComponentLookupException {
-        DefaultRepositorySystemSession repoSession =
-                (DefaultRepositorySystemSession) legacySupport.getRepositorySession();
-        RepositorySystem system = lookup(RepositorySystem.class);
-        String directory = stubFactory.getWorkingDir().toString();
-        LocalRepository localRepository = new LocalRepository(directory);
-        LocalRepositoryManager manager = system.newLocalRepositoryManager(repoSession, localRepository);
-        repoSession.setLocalRepositoryManager(manager);
-    }
-
-    protected void installLocalRepository(RepositorySystemSession repoSession) throws ComponentLookupException {
-        RepositorySystem system = lookup(RepositorySystem.class);
-        String directory = stubFactory.getWorkingDir().toString();
-        LocalRepository localRepository = new LocalRepository(directory);
-        LocalRepositoryManager manager = system.newLocalRepositoryManager(repoSession, localRepository);
-        ((DefaultRepositorySystemSession) repoSession).setLocalRepositoryManager(manager);
-    }
-}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java b/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
index f93ee2ce..bef7be30 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
@@ -18,40 +18,33 @@
  */
 package org.apache.maven.plugins.dependency;
 
-import java.io.File;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugins.dependency.resolvers.CollectDependenciesMojo;
-import org.apache.maven.plugins.dependency.resolvers.ResolveDependenciesMojo;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugins.dependency.utils.DependencySilentLog;
 import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
 import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class TestCollectMojo extends AbstractDependencyMojoTestCase {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "markers";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return false;
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+@MojoTest
+class TestCollectMojo {
 
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    private DependencyArtifactStubFactory stubFactory;
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(null, false);
     }
 
     /**
@@ -59,9 +52,9 @@ public class TestCollectMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception if a problem occurs
      */
-    public void testCollectTestEnvironment() throws Exception {
-        File testPom = new File(getBasedir(), "target/test-classes/unit/collect-test/plugin-config.xml");
-        CollectDependenciesMojo mojo = (CollectDependenciesMojo) lookupMojo("collect", testPom);
+    @Test
+    @InjectMojo(goal = "collect")
+    void testCollectTestEnvironment(CollectDependenciesMojo mojo) throws Exception {
 
         assertNotNull(mojo);
         assertNotNull(mojo.getProject());
@@ -85,10 +78,10 @@ public class TestCollectMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception if a problem occurs
      */
-    public void testCollectTestEnvironmentExcludeTransitive() throws Exception {
-        File testPom = new File(getBasedir(), "target/test-classes/unit/collect-test/plugin-config.xml");
-        CollectDependenciesMojo mojo = (CollectDependenciesMojo) lookupMojo("collect", testPom);
-
+    @Test
+    @InjectMojo(goal = "collect")
+    @MojoParameter(name = "excludeTransitive", value = "true")
+    void testCollectTestEnvironmentExcludeTransitive(CollectDependenciesMojo mojo) throws Exception {
         assertNotNull(mojo);
         assertNotNull(mojo.getProject());
         MavenProject project = mojo.getProject();
@@ -100,18 +93,15 @@ public class TestCollectMojo extends AbstractDependencyMojoTestCase {
         project.setArtifacts(artifacts);
         project.setDependencyArtifacts(directArtifacts);
 
-        setVariableValueToObject(mojo, "excludeTransitive", Boolean.TRUE);
-
         mojo.execute();
         DependencyStatusSets results = mojo.getResults();
         assertNotNull(results);
         assertEquals(directArtifacts.size(), results.getResolvedDependencies().size());
     }
 
-    public void testSilent() throws Exception {
-        File testPom = new File(getBasedir(), "target/test-classes/unit/resolve-test/plugin-config.xml");
-        ResolveDependenciesMojo mojo = (ResolveDependenciesMojo) lookupMojo("resolve", testPom);
-
+    @Test
+    @InjectMojo(goal = "collect")
+    void testSilent(CollectDependenciesMojo mojo) throws Exception {
         assertFalse(mojo.getLog() instanceof DependencySilentLog);
 
         mojo.setSilent(true);
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java b/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java
index ae793392..2cdb4783 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java
@@ -18,20 +18,21 @@
  */
 package org.apache.maven.plugins.dependency;
 
-import java.io.File;
+import javax.inject.Inject;
+
 import java.net.InetAddress;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Collections;
 
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.settings.Server;
 import org.apache.maven.settings.Settings;
 import org.eclipse.jetty.security.ConstraintMapping;
@@ -43,47 +44,32 @@ import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.handler.ContextHandler;
 import org.eclipse.jetty.server.handler.ResourceHandler;
 import org.eclipse.jetty.util.security.Constraint;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class TestGetMojo extends AbstractDependencyMojoTestCase {
-    private GetMojo mojo;
-
-    @Override
-    protected String getTestDirectoryName() {
-        return "markers";
-    }
+import static org.apache.maven.api.plugin.testing.MojoExtension.getTestPath;
+import static org.apache.maven.api.plugin.testing.MojoExtension.setVariableValueToObject;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.mockito.Mockito.when;
 
-    @Override
-    protected boolean shouldCreateFiles() {
-        return false;
-    }
+@MojoTest(realRepositorySession = true)
+@Basedir("/unit/get-test")
+class TestGetMojo {
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    @Inject
+    private MavenSession session;
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    @BeforeEach
+    void setUp() {
+        Settings settings = new Settings();
+        when(session.getSettings()).thenReturn(settings);
 
-        File testPom = new File(getBasedir(), "target/test-classes/unit/get-test/plugin-config.xml");
-        mojo = (GetMojo) lookupMojo("get", testPom);
-
-        assertNotNull(mojo);
-
-        LegacySupport legacySupport = lookup(LegacySupport.class);
-        Settings settings = session.getSettings();
         Server server = new Server();
         server.setId("myserver");
         server.setUsername("foo");
         server.setPassword("bar");
         settings.addServer(server);
-        legacySupport.setSession(session);
-
-        installLocalRepository(legacySupport);
-
-        setVariableValueToObject(mojo, "session", legacySupport.getSession());
     }
 
     /**
@@ -91,19 +77,19 @@ public class TestGetMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of errors
      */
-    public void testTransitive() throws Exception {
-        // Set properties, transitive = default value = true
-        setVariableValueToObject(mojo, "transitive", Boolean.FALSE);
-        setVariableValueToObject(mojo, "remoteRepositories", "central::default::https://repo.maven.apache.org/maven2");
+    @Test
+    @InjectMojo(goal = "get")
+    @MojoParameter(name = "transitive", value = "false")
+    void testTransitive(GetMojo mojo) throws Exception {
+        DefaultProjectBuildingRequest pbr = new DefaultProjectBuildingRequest();
+        pbr.setRepositorySession(session.getRepositorySession());
+        when(session.getProjectBuildingRequest()).thenReturn(pbr);
+
         mojo.setGroupId("org.apache.maven");
         mojo.setArtifactId("maven-model");
         mojo.setVersion("2.0.9");
 
         mojo.execute();
-
-        // Set properties, transitive = false
-        setVariableValueToObject(mojo, "transitive", Boolean.FALSE);
-        mojo.execute();
     }
 
     /**
@@ -111,12 +97,17 @@ public class TestGetMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of errors
      */
-    public void testRemoteRepositories() throws Exception {
-        setVariableValueToObject(
-                mojo,
-                "remoteRepositories",
-                "central::default::https://repo.maven.apache.org/maven2,"
-                        + "central::::https://repo.maven.apache.org/maven2," + "https://repo.maven.apache.org/maven2");
+    @Test
+    @InjectMojo(goal = "get")
+    @MojoParameter(
+            name = "remoteRepositories",
+            value =
+                    "central::default::https://repo.maven.apache.org/maven2,central::::https://repo.maven.apache.org/maven2,https://repo.maven.apache.org/maven2")
+    void testRemoteRepositories(GetMojo mojo) throws Exception {
+        DefaultProjectBuildingRequest pbr = new DefaultProjectBuildingRequest();
+        pbr.setRepositorySession(session.getRepositorySession());
+        when(session.getProjectBuildingRequest()).thenReturn(pbr);
+
         mojo.setGroupId("org.apache.maven");
         mojo.setArtifactId("maven-model");
         mojo.setVersion("2.0.9");
@@ -129,7 +120,9 @@ public class TestGetMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of errors
      */
-    public void testRemoteRepositoriesAuthentication() throws Exception {
+    @Test
+    @InjectMojo(goal = "get")
+    void testRemoteRepositoriesAuthentication(GetMojo mojo) throws Exception {
         org.eclipse.jetty.server.Server server = createServer();
         try {
             server.start();
@@ -141,6 +134,11 @@ public class TestGetMojo extends AbstractDependencyMojoTestCase {
             url = url + ":" + serverConnector.getLocalPort() + "/maven";
 
             setVariableValueToObject(mojo, "remoteRepositories", "myserver::default::" + url);
+
+            DefaultProjectBuildingRequest pbr = new DefaultProjectBuildingRequest();
+            pbr.setRepositorySession(session.getRepositorySession());
+            when(session.getProjectBuildingRequest()).thenReturn(pbr);
+
             mojo.setGroupId("test");
             mojo.setArtifactId("test");
             mojo.setVersion("1.0");
@@ -156,7 +154,9 @@ public class TestGetMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of errors
      */
-    public void testParseRepository() throws Exception {
+    @Test
+    @InjectMojo(goal = "get")
+    void testParseRepository(GetMojo mojo) throws Exception {
         ArtifactRepositoryPolicy policy = null;
         ArtifactRepository repo =
                 mojo.parseRepository("central::default::https://repo.maven.apache.org/maven2", policy);
@@ -197,8 +197,7 @@ public class TestGetMojo extends AbstractDependencyMojoTestCase {
 
     private ContextHandler createContextHandler() {
         ResourceHandler resourceHandler = new ResourceHandler();
-        Path resourceDirectory = Paths.get("src", "test", "resources", "unit", "get-test", "repository");
-        resourceHandler.setResourceBase(resourceDirectory.toString());
+        resourceHandler.setResourceBase(getTestPath("repository"));
         resourceHandler.setDirectoriesListed(true);
 
         ContextHandler contextHandler = new ContextHandler("/maven");
@@ -210,8 +209,7 @@ public class TestGetMojo extends AbstractDependencyMojoTestCase {
         org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(0);
         server.setStopAtShutdown(true);
 
-        LoginService loginService =
-                new HashLoginService("myrealm", "src/test/resources/unit/get-test/realm.properties");
+        LoginService loginService = new HashLoginService("myrealm", getTestPath("realm.properties"));
         server.addBean(loginService);
 
         ConstraintSecurityHandler security = new ConstraintSecurityHandler();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestListClassesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/TestListClassesMojo.java
index bc26ecbc..4ad54f10 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestListClassesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestListClassesMojo.java
@@ -20,39 +20,30 @@ package org.apache.maven.plugins.dependency;
 
 import javax.inject.Inject;
 
-import java.io.File;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
 
-import org.apache.maven.api.di.Provides;
 import org.apache.maven.api.plugin.testing.Basedir;
 import org.apache.maven.api.plugin.testing.InjectMojo;
 import org.apache.maven.api.plugin.testing.MojoParameter;
 import org.apache.maven.api.plugin.testing.MojoTest;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.execution.DefaultMavenExecutionRequest;
-import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory;
 import org.apache.maven.plugin.logging.Log;
-import org.eclipse.aether.RepositorySystemSession;
 import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.junit.jupiter.MockitoExtension;
 
 import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
 
 @ExtendWith(MockitoExtension.class)
-@MojoTest
+@MojoTest(realRepositorySession = true)
 class TestListClassesMojo {
 
     @Inject
@@ -61,28 +52,9 @@ class TestListClassesMojo {
     @Inject
     private DefaultRepositorySystemSessionFactory repoSessionFactory;
 
-    @Mock
+    @Inject
     private Log log;
 
-    @Provides
-    @SuppressWarnings("unused")
-    private Log logProvides() {
-        return log;
-    }
-
-    @BeforeEach
-    void setUp() {
-        ArtifactRepository localRepo = Mockito.mock(ArtifactRepository.class);
-        when(localRepo.getBasedir()).thenReturn(new File(getBasedir(), "target/local-repo").getAbsolutePath());
-
-        MavenExecutionRequest request = new DefaultMavenExecutionRequest();
-        request.setLocalRepository(localRepo);
-
-        RepositorySystemSession systemSession = repoSessionFactory.newRepositorySession(request);
-        when(mavenSession.getRepositorySession()).thenReturn(systemSession);
-        when(mavenSession.getRequest()).thenReturn(request);
-    }
-
     @Test
     @InjectMojo(goal = "list-classes")
     @MojoParameter(
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java b/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
index 2330a6c5..582b5687 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
@@ -20,7 +20,6 @@ package org.apache.maven.plugins.dependency;
 
 import javax.inject.Inject;
 
-import org.apache.maven.api.di.Provides;
 import org.apache.maven.api.plugin.testing.InjectMojo;
 import org.apache.maven.api.plugin.testing.MojoParameter;
 import org.apache.maven.api.plugin.testing.MojoTest;
@@ -45,29 +44,20 @@ import org.apache.maven.plugins.dependency.resolvers.ResolveDependenciesMojo;
 import org.apache.maven.plugins.dependency.resolvers.ResolvePluginsMojo;
 import org.apache.maven.plugins.dependency.tree.TreeMojo;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
 
 import static org.mockito.ArgumentMatchers.contains;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-@ExtendWith(MockitoExtension.class)
 @MojoTest
 class TestSkip {
 
     @Inject
     private MojoExecution mojoExecution;
 
-    @Mock
+    @Inject
     private Log log;
 
-    @Provides
-    private Log logProvides() {
-        return log;
-    }
-
     @Test
     @InjectMojo(goal = "analyze")
     @MojoParameter(name = "skip", value = "true")
diff --git a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java
index 674bcd15..1858dd1c 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java
@@ -31,7 +31,6 @@ import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.model.Exclusion;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
 import org.apache.maven.project.MavenProject;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -57,7 +56,7 @@ class TestAnalyzeDepMgt {
     @BeforeEach
     void setUp() throws Exception {
 
-        MavenProject project = new DependencyProjectStub();
+        MavenProject project = new MavenProject();
         mojo = new AnalyzeDepMgt(project);
 
         stubFactory = new DependencyArtifactStubFactory(new File(""), false);
@@ -199,8 +198,8 @@ class TestAnalyzeDepMgt {
         // test with nothing in depMgt
         mojo.execute();
 
-        DependencyProjectStub project = (DependencyProjectStub) mojo.getProject();
-        project.setDependencyManagement(depMgt);
+        MavenProject project = mojo.getProject();
+        project.getModel().setDependencyManagement(depMgt);
         // test with exclusion
         mojo.execute();
 
diff --git a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
index b09c5697..e767af56 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
@@ -20,20 +20,12 @@ package org.apache.maven.plugins.dependency.analyze;
 
 import javax.inject.Inject;
 
-import java.io.File;
-
-import org.apache.maven.api.di.Provides;
 import org.apache.maven.api.plugin.testing.Basedir;
 import org.apache.maven.api.plugin.testing.InjectMojo;
-import org.apache.maven.api.plugin.testing.MojoExtension;
 import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.verify;
@@ -43,26 +35,16 @@ import static org.mockito.Mockito.when;
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  * @version $Id$
  */
-@ExtendWith(MockitoExtension.class)
 @MojoTest
-public class TestAnalyzeDuplicateMojo {
+class TestAnalyzeDuplicateMojo {
 
     @Inject
-    private MavenProject project;
-
-    @Mock
     private Log log;
 
-    @Provides
-    private Log logProvides() {
-        return log;
-    }
-
     @Test
     @Basedir("/unit/duplicate-dependencies")
-    @InjectMojo(goal = "analyze-duplicate")
-    public void testDuplicate(AnalyzeDuplicateMojo mojo) throws Exception {
-        when(project.getFile()).thenReturn(new File(MojoExtension.getBasedir(), "plugin-config.xml"));
+    @InjectMojo(goal = "analyze-duplicate", pom = "plugin-config.xml")
+    void testDuplicate(AnalyzeDuplicateMojo mojo) throws Exception {
         when(log.isInfoEnabled()).thenReturn(true);
 
         mojo.execute();
@@ -78,9 +60,8 @@ public class TestAnalyzeDuplicateMojo {
 
     @Test
     @Basedir("/unit/duplicate-dependencies")
-    @InjectMojo(goal = "analyze-duplicate")
-    public void testDuplicate2(AnalyzeDuplicateMojo mojo) throws Exception {
-        when(project.getFile()).thenReturn(new File(MojoExtension.getBasedir(), "plugin-config2.xml"));
+    @InjectMojo(goal = "analyze-duplicate", pom = "plugin-config2.xml")
+    void testDuplicate2(AnalyzeDuplicateMojo mojo) throws Exception {
         when(log.isInfoEnabled()).thenReturn(true);
 
         mojo.execute();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/exclusion/AnalyzeExclusionsMojoTest.java b/src/test/java/org/apache/maven/plugins/dependency/exclusion/AnalyzeExclusionsMojoTest.java
index dfc9cfa5..484f0207 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/exclusion/AnalyzeExclusionsMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/exclusion/AnalyzeExclusionsMojoTest.java
@@ -68,14 +68,9 @@ class AnalyzeExclusionsMojoTest {
     @Inject
     private MavenSession mavenSession;
 
-    @Mock
+    @Inject
     private Log testLog;
 
-    @Provides
-    private Log testLogProvides() {
-        return testLog;
-    }
-
     @Mock
     private ResolverUtil resolverUtil;
 
@@ -85,7 +80,7 @@ class AnalyzeExclusionsMojoTest {
     }
 
     @BeforeEach
-    protected void setUp() throws Exception {
+    void setUp() {
         when(project.getGroupId()).thenReturn("testGroupId");
         when(project.getArtifactId()).thenReturn("testArtifactId");
         when(project.getVersion()).thenReturn("1.0.0");
@@ -100,7 +95,7 @@ class AnalyzeExclusionsMojoTest {
     @Test
     @InjectMojo(goal = "analyze-exclusions")
     @MojoParameter(name = "exclusionFail", value = "true")
-    void testShallThrowExceptionWhenFailOnWarning(AnalyzeExclusionsMojo mojo) throws Exception {
+    void testShallThrowExceptionWhenFailOnWarning(AnalyzeExclusionsMojo mojo) {
         List<Dependency> dependencies = new ArrayList<>();
         Dependency withInvalidExclusion = dependency("a", "b");
         withInvalidExclusion.addExclusion(exclusion("invalid", "invalid"));
@@ -158,7 +153,7 @@ class AnalyzeExclusionsMojoTest {
 
     @Test
     @InjectMojo(goal = "analyze-exclusions")
-    void testCanResolveMultipleArtifactsWithEqualGroupIdAndArtifactId(AnalyzeExclusionsMojo mojo) throws Exception {
+    void testCanResolveMultipleArtifactsWithEqualGroupIdAndArtifactId(AnalyzeExclusionsMojo mojo) {
         Dependency dependency1 = dependency("a", "b");
         Dependency dependency2 = dependency("a", "b", "compile", "native");
         dependency1.addExclusion(exclusion("c", "d"));
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
index a619d775..57c4e0da 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
@@ -18,70 +18,69 @@
  */
 package org.apache.maven.plugins.dependency.fromConfiguration;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
 import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-public class TestCopyMojo extends AbstractDependencyMojoTestCase {
-    private CopyMojo mojo;
-
-    @Override
-    protected String getTestDirectoryName() {
-        return "copy";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return false;
-    }
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.AssertionsKt.assertNull;
 
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
-    }
+@MojoTest(realRepositorySession = true)
+class TestCopyMojo {
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+    @TempDir
+    private File tempDir;
 
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    private DependencyArtifactStubFactory stubFactory;
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    @Inject
+    private MavenSession session;
 
-        File testPom = new File(getBasedir(), "target/test-classes/unit/copy-test/plugin-config.xml");
-        mojo = (CopyMojo) lookupMojo("copy", testPom);
-        mojo.setOutputDirectory(new File(this.testDir, "outputDirectory"));
+    @Inject
+    private MavenProject project;
 
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
+    @BeforeEach
+    void setUp() {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
 
-        installLocalRepository(session.getRepositorySession());
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
     }
 
-    private ArtifactItem getSingleArtifactItem(boolean removeVersion, boolean useBaseVersion)
-            throws MojoExecutionException {
-        List<ArtifactItem> list = mojo.getProcessedArtifactItems(
-                new ProcessArtifactItemsRequest(removeVersion, false, useBaseVersion, false));
+    private ArtifactItem getSingleArtifactItem(CopyMojo mojo) throws MojoExecutionException {
+        List<ArtifactItem> list =
+                mojo.getProcessedArtifactItems(new ProcessArtifactItemsRequest(false, false, false, false));
         return list.get(0);
     }
 
-    public void testSetArtifactWithoutPackaging() throws Exception {
-        mojo.setArtifact("a:b:c");
+    @Test
+    @InjectMojo(goal = "copy")
+    @MojoParameter(name = "artifact", value = "a:b:c")
+    void testSetArtifactWithoutPackaging(CopyMojo mojo) {
         ArtifactItem item = mojo.getArtifactItems().get(0);
         assertEquals("a", item.getGroupId());
         assertEquals("b", item.getArtifactId());
@@ -90,8 +89,10 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertNull(item.getClassifier());
     }
 
-    public void testSetArtifactWithoutClassifier() throws Exception {
-        mojo.setArtifact("a:b:c:d");
+    @Test
+    @InjectMojo(goal = "copy")
+    @MojoParameter(name = "artifact", value = "a:b:c:d")
+    void testSetArtifactWithoutClassifier(CopyMojo mojo) {
         ArtifactItem item = mojo.getArtifactItems().get(0);
         assertEquals("a", item.getGroupId());
         assertEquals("b", item.getArtifactId());
@@ -100,8 +101,10 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertNull(item.getClassifier());
     }
 
-    public void testSetArtifact() throws Exception {
-        mojo.setArtifact("a:b:c:d:e");
+    @Test
+    @InjectMojo(goal = "copy")
+    @MojoParameter(name = "artifact", value = "a:b:c:d:e")
+    void testSetArtifact(CopyMojo mojo) {
         ArtifactItem item = mojo.getArtifactItems().get(0);
         assertEquals("a", item.getGroupId());
         assertEquals("b", item.getArtifactId());
@@ -110,7 +113,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertEquals("e", item.getClassifier());
     }
 
-    public void testGetArtifactItems() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testGetArtifactItems(CopyMojo mojo) throws Exception {
 
         ArtifactItem item = new ArtifactItem();
 
@@ -123,49 +128,52 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
 
         mojo.setArtifactItems(createArtifactItemArtifacts(list));
 
-        ArtifactItem result = getSingleArtifactItem(false, false);
+        ArtifactItem result = getSingleArtifactItem(mojo);
         assertEquals(mojo.getOutputDirectory(), result.getOutputDirectory());
 
         File output = new File(mojo.getOutputDirectory(), "override");
         item.setOutputDirectory(output);
-        result = getSingleArtifactItem(false, false);
+        result = getSingleArtifactItem(mojo);
         assertEquals(output, result.getOutputDirectory());
     }
 
-    public void assertFilesExist(Collection<ArtifactItem> items, boolean exist) {
+    private void assertFilesExist(Collection<ArtifactItem> items) {
         for (ArtifactItem item : items) {
-            assertFileExists(item, exist);
+            assertFileExists(item);
         }
     }
 
-    public void assertFileExists(ArtifactItem item, boolean exist) {
+    private void assertFileExists(ArtifactItem item) {
         File file = new File(item.getOutputDirectory(), item.getDestFileName());
-        assertEquals(exist, file.exists());
+        assertTrue(file.exists());
     }
 
-    public void testMojoDefaults() {
-        CopyMojo theMojo = new CopyMojo(null, null, null, null, null, null);
-
-        assertFalse(theMojo.isStripVersion());
-        assertFalse(theMojo.isSkip());
-        assertFalse(theMojo.isStripClassifier());
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMojoDefaults(CopyMojo mojo) {
+        assertFalse(mojo.isStripVersion());
+        assertFalse(mojo.isSkip());
+        assertFalse(mojo.isStripClassifier());
     }
 
-    public void testCopyFile() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyFile(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
 
         mojo.setArtifactItems(createArtifactItemArtifacts(list));
 
         mojo.execute();
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
     /**
-     * New version of resolver on classpath does not support timestamp version lookups in local repository.
      * TODO move to an integration test ...
      */
-    public void skipTestCopyFileWithBaseVersion() throws Exception {
+    @Test
+    @Disabled("New version of resolver on classpath does not support timestamp version lookups in local repository.")
+    void skipTestCopyFileWithBaseVersion(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
         ArtifactItem item = new ArtifactItem();
 
@@ -179,24 +187,29 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
-    public void testSkip() throws Exception {
-        List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
-
-        mojo.setSkip(true);
-        mojo.setArtifactItems(list);
+    @Test
+    @InjectMojo(goal = "copy")
+    @MojoParameter(name = "skip", value = "true")
+    @MojoParameter(name = "artifact", value = "a:b:c")
+    void testSkip(CopyMojo mojo) throws Exception {
 
         mojo.execute();
-        for (ArtifactItem item : list) {
+
+        assertFalse(mojo.getArtifactItems().isEmpty());
+
+        for (ArtifactItem item : mojo.getArtifactItems()) {
             // these will be null because no processing has occured only when everything is skipped
             assertNull(item.getOutputDirectory());
             assertNull(item.getDestFileName());
         }
     }
 
-    public void testCopyFileNoOverwrite() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyFileNoOverwrite(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
 
         for (ArtifactItem item : list) {
@@ -207,10 +220,12 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         mojo.setArtifactItems(createArtifactItemArtifacts(list));
         mojo.execute();
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
-    public void testCopyToLocation() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyToLocation(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
         ArtifactItem item = list.get(0);
         item.setOutputDirectory(new File(mojo.getOutputDirectory(), "testOverride"));
@@ -219,10 +234,12 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
-    public void testCopyStripVersionSetInMojo() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyStripVersionSetInMojo(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
 
         ArtifactItem item = list.get(0);
@@ -234,10 +251,12 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         mojo.execute();
         assertEquals(DependencyUtil.getFormattedFileName(item.getArtifact(), true), item.getDestFileName());
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
-    public void testCopyStripClassifierSetInMojo() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyStripClassifierSetInMojo(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
 
         ArtifactItem item = list.get(0);
@@ -251,30 +270,36 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
                 DependencyUtil.getFormattedFileName(item.getArtifact(), false, false, false, true),
                 item.getDestFileName());
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
-    public void testNonClassifierStrip() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testNonClassifierStrip(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getReleaseAndSnapshotArtifacts());
         mojo.setStripVersion(true);
         mojo.setArtifactItems(createArtifactItemArtifacts(list));
 
         mojo.execute();
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
-    public void testNonClassifierNoStrip() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testNonClassifierNoStrip(CopyMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getReleaseAndSnapshotArtifacts());
 
         mojo.setArtifactItems(createArtifactItemArtifacts(list));
 
         mojo.execute();
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
-    public void testMissingVersionNotFound() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMissingVersionNotFound(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -294,7 +319,7 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public List<Dependency> getDependencyList(ArtifactItem item) {
+    private List<Dependency> getDependencyList(ArtifactItem item) {
         Dependency dep = new Dependency();
         dep.setArtifactId(item.getArtifactId());
         dep.setClassifier(item.getClassifier());
@@ -316,7 +341,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         return list;
     }
 
-    public void testMissingVersionFromDependencies() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMissingVersionFromDependencies(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -332,11 +359,13 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         project.setDependencies(createDependencyArtifacts(getDependencyList(item)));
 
         mojo.execute();
-        this.assertFileExists(item, true);
+        this.assertFileExists(item);
         assertEquals("2.0-SNAPSHOT", item.getVersion());
     }
 
-    public void testMissingVersionFromDependenciesLooseMatch() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMissingVersionFromDependenciesLooseMatch(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -361,11 +390,13 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         mojo.setArtifactItems(list);
 
         mojo.execute();
-        this.assertFileExists(item, true);
+        this.assertFileExists(item);
         assertEquals("2.1", item.getVersion());
     }
 
-    public void testMissingVersionFromDependenciesWithClassifier() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMissingVersionFromDependenciesWithClassifier(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -381,11 +412,11 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         project.setDependencies(createDependencyArtifacts(getDependencyList(item)));
 
         mojo.execute();
-        this.assertFileExists(item, true);
+        this.assertFileExists(item);
         assertEquals("2.1", item.getVersion());
     }
 
-    public List<Dependency> getDependencyMgtList(ArtifactItem item) {
+    private List<Dependency> getDependencyMgtList(ArtifactItem item) {
         Dependency dep = new Dependency();
         dep.setArtifactId(item.getArtifactId());
         dep.setClassifier(item.getClassifier());
@@ -407,7 +438,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         return list;
     }
 
-    public void testMissingVersionFromDependencyMgt() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMissingVersionFromDependencyMgt(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -430,15 +463,19 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
 
         mojo.setArtifactItems(list);
 
-        project.getDependencyManagement().setDependencies(createDependencyArtifacts(getDependencyMgtList(item)));
+        DependencyManagement dependencyManagement = new DependencyManagement();
+        dependencyManagement.setDependencies(createDependencyArtifacts(getDependencyMgtList(item)));
+        project.getModel().setDependencyManagement(dependencyManagement);
 
         mojo.execute();
 
-        this.assertFileExists(item, true);
+        this.assertFileExists(item);
         assertEquals("3.0-SNAPSHOT", item.getVersion());
     }
 
-    public void testMissingVersionFromDependencyMgtLooseMatch() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMissingVersionFromDependencyMgtLooseMatch(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -461,7 +498,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
 
         mojo.setArtifactItems(list);
 
-        project.getDependencyManagement().setDependencies(createDependencyArtifacts(getDependencyMgtList(item)));
+        DependencyManagement dependencyManagement = new DependencyManagement();
+        dependencyManagement.setDependencies(createDependencyArtifacts(getDependencyMgtList(item)));
+        project.getModel().setDependencyManagement(dependencyManagement);
 
         item.setType("jar");
 
@@ -472,11 +511,13 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        this.assertFileExists(item, true);
+        this.assertFileExists(item);
         assertEquals("3.1", item.getVersion());
     }
 
-    public void testMissingVersionFromDependencyMgtWithClassifier() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testMissingVersionFromDependencyMgtWithClassifier(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -499,15 +540,19 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
 
         mojo.setArtifactItems(list);
 
-        project.getDependencyManagement().setDependencies(createDependencyArtifacts(getDependencyMgtList(item)));
+        DependencyManagement dependencyManagement = new DependencyManagement();
+        dependencyManagement.setDependencies(createDependencyArtifacts(getDependencyMgtList(item)));
+        project.getModel().setDependencyManagement(dependencyManagement);
 
         mojo.execute();
 
-        this.assertFileExists(item, true);
+        this.assertFileExists(item);
         assertEquals("3.1", item.getVersion());
     }
 
-    public void testArtifactNotFound() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testArtifactNotFound(CopyMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -528,7 +573,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testNoArtifactItems() {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testNoArtifactItems(CopyMojo mojo) {
         try {
             mojo.getProcessedArtifactItems(new ProcessArtifactItemsRequest(false, false, false, false));
             fail("Expected Exception");
@@ -537,7 +584,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testCopyDontOverWriteReleases() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyDontOverWriteReleases(CopyMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact release = stubFactory.getReleaseArtifact();
         assertTrue(release.getFile().setLastModified(System.currentTimeMillis() - 2000));
@@ -566,7 +615,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertEquals(time, copiedFile.lastModified());
     }
 
-    public void testCopyDontOverWriteSnapshots() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyDontOverWriteSnapshots(CopyMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact artifact = stubFactory.getSnapshotArtifact();
         assertTrue(artifact.getFile().setLastModified(System.currentTimeMillis() - 2000));
@@ -595,7 +646,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertEquals(time, copiedFile.lastModified());
     }
 
-    public void testCopyOverWriteReleases() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyOverWriteReleases(CopyMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact release = stubFactory.getReleaseArtifact();
         assertTrue(release.getFile().setLastModified(1000L));
@@ -622,7 +675,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertEquals(1000L, timeCopyNow);
     }
 
-    public void testCopyOverWriteSnapshot() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyOverWriteSnapshot(CopyMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact artifact = stubFactory.getSnapshotArtifact();
         assertTrue(artifact.getFile().setLastModified(1000L));
@@ -650,7 +705,9 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertEquals(1000L, timeCopyNow);
     }
 
-    public void testCopyOverWriteIfNewer() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyOverWriteIfNewer(CopyMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact artifact = stubFactory.getSnapshotArtifact();
         assertTrue(artifact.getFile().setLastModified(System.currentTimeMillis() - 2000));
@@ -677,30 +734,28 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
         assertTrue(time < copiedFile.lastModified());
     }
 
-    public void testCopyFileWithOverideLocalRepo() throws Exception {
-        final File localRepo = stubFactory.getWorkingDir();
+    @Test
+    @InjectMojo(goal = "copy")
+    void testCopyFileWithOverideLocalRepo(CopyMojo mojo) throws Exception {
 
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
 
         mojo.setArtifactItems(list);
 
-        File execLocalRepo = new File(this.testDir.getAbsolutePath(), "executionLocalRepo");
+        File execLocalRepo = new File(tempDir, "executionLocalRepo");
         assertFalse(execLocalRepo.exists());
 
         stubFactory.setWorkingDir(execLocalRepo);
         createArtifactItemArtifacts(list);
 
-        assertFalse("default local repo should not exist", localRepo.exists());
-
         mojo.setLocalRepositoryDirectory(execLocalRepo);
 
         mojo.execute();
 
-        assertFilesExist(list, true);
+        assertFilesExist(list);
     }
 
     private List<Dependency> createDependencyArtifacts(List<Dependency> items) throws IOException {
-        stubFactory.setCreateFiles(true);
         for (Dependency item : items) {
             String classifier = "".equals(item.getClassifier()) ? null : item.getClassifier();
             stubFactory.createArtifact(
@@ -723,7 +778,6 @@ public class TestCopyMojo extends AbstractDependencyMojoTestCase {
     }
 
     private ArtifactItem createArtifact(ArtifactItem item) throws IOException {
-        stubFactory.setCreateFiles(true);
 
         String classifier = "".equals(item.getClassifier()) ? null : item.getClassifier();
         String version = item.getVersion() != null ? item.getVersion() : item.getBaseVersion();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java
index 4d1ff3ed..aef56025 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java
@@ -18,95 +18,79 @@
  */
 package org.apache.maven.plugins.dependency.fromConfiguration;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoExtension;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugins.dependency.utils.markers.UnpackFileMarkerHandler;
 import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase {
-    private static final String PACKED_FILE = "test.zip";
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
-    private static final String UNPACKED_FILE_PREFIX = "test";
+@MojoTest(realRepositorySession = true)
+@Basedir("/unit/unpack-dependencies-test")
+@MojoParameter(name = "artifact", value = "test:test:1.0")
+class TestIncludeExcludeUnpackMojo {
 
-    private static final String UNPACKED_FILE_SUFFIX = ".txt";
+    @TempDir
+    private File tempDir;
 
-    private static final String PACKED_FILE_PATH = "target/test-classes/unit/unpack-dependencies-test/" + PACKED_FILE;
+    private DependencyArtifactStubFactory stubFactory;
 
-    private UnpackMojo mojo;
-
-    @Override
-    protected String getTestDirectoryName() {
-        return "unpack";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
-
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
-    }
+    @Inject
+    private MavenSession session;
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+    @Inject
+    private MavenProject project;
 
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
-
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    private static final String UNPACKED_FILE_PREFIX = "test";
 
-        File testPom = new File(getBasedir(), "target/test-classes/unit/unpack-test/plugin-config.xml");
-        mojo = (UnpackMojo) lookupMojo("unpack", testPom);
-        mojo.setOutputDirectory(new File(this.testDir, "outputDirectory"));
+    private static final String UNPACKED_FILE_SUFFIX = ".txt";
 
-        // I'm using one file repeatedly to archive so I can test the name
-        // programmatically.
-        stubFactory.setSrcFile(new File(getBasedir() + File.separatorChar + PACKED_FILE_PATH));
-        Artifact artifact = stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
-        ArtifactItem item = new ArtifactItem(artifact);
-        List<ArtifactItem> list = new ArrayList<>(1);
-        list.add(item);
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        stubFactory.setSrcFile(MojoExtension.getTestFile("test.zip"));
+        stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
 
-        mojo.setMarkersDirectory(new File(this.testDir, "markers"));
-        mojo.setArtifactItems(list);
+        session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
 
-        LegacySupport legacySupport = lookup(LegacySupport.class);
-        legacySupport.setSession(session);
-        installLocalRepository(legacySupport);
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
     }
 
-    public void assertMarkerFiles(Collection<ArtifactItem> items, boolean exist) {
+    private void assertMarkerFiles(UnpackMojo mojo, Collection<ArtifactItem> items) {
         for (ArtifactItem item : items) {
-            assertMarkerFile(exist, item);
+            assertMarkerFile(mojo, item);
         }
     }
 
-    public void assertMarkerFile(boolean val, ArtifactItem item) {
+    private void assertMarkerFile(UnpackMojo mojo, ArtifactItem item) {
         UnpackFileMarkerHandler handle = new UnpackFileMarkerHandler(item, mojo.getMarkersDirectory());
         try {
-            assertEquals(val, handle.isMarkerSet());
+            assertTrue(handle.isMarkerSet());
         } catch (MojoExecutionException e) {
             fail(e.getLongMessage());
         }
     }
 
-    private void assertUnpacked(boolean unpacked, String fileName) {
+    private void assertUnpacked(UnpackMojo mojo, boolean unpacked, String fileName) {
         File destFile = new File(mojo.getOutputDirectory().getAbsolutePath(), fileName);
         assertEquals(unpacked, destFile.exists());
     }
@@ -116,13 +100,15 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
      *
      * @throws Exception in case of errors.
      */
-    public void testUnpackIncludesManyFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackIncludesManyFiles(UnpackMojo mojo) throws Exception {
         mojo.setIncludes("**/*1" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -130,13 +116,15 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
      *
      * @throws Exception in case of errors.
      */
-    public void testUnpackIncludesSingleFile() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackIncludesSingleFile(UnpackMojo mojo) throws Exception {
         mojo.setIncludes("**/test2" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -144,13 +132,15 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
      *
      * @throws Exception in case of errors.
      */
-    public void testUnpackIncludesAllFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackIncludesAllFiles(UnpackMojo mojo) throws Exception {
         mojo.setIncludes("**/*");
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -158,13 +148,15 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
      *
      * @throws Exception in case of errors.
      */
-    public void testUnpackExcludesManyFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackExcludesManyFiles(UnpackMojo mojo) throws Exception {
         mojo.setExcludes("**/*1" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -172,13 +164,15 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
      *
      * @throws Exception in case of errors.
      */
-    public void testUnpackExcludesSingleFile() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackExcludesSingleFile(UnpackMojo mojo) throws Exception {
         mojo.setExcludes("**/test2" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -186,24 +180,30 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
      *
      * @throws Exception in case of errors.
      */
-    public void testUnpackExcludesAllFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackExcludesAllFiles(UnpackMojo mojo) throws Exception {
         mojo.setExcludes("**/*");
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
-    public void testNoIncludeExcludes() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testNoIncludeExcludes(UnpackMojo mojo) throws Exception {
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
-    public void testIncludeArtifactItemOverride() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testIncludeArtifactItemOverride(UnpackMojo mojo) throws Exception {
         Artifact artifact = stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
         ArtifactItem item = new ArtifactItem(artifact);
         item.setIncludes("**/*");
@@ -212,13 +212,15 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
         mojo.setArtifactItems(list);
         mojo.setIncludes("**/test2" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
-    public void testExcludeArtifactItemOverride() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testExcludeArtifactItemOverride(UnpackMojo mojo) throws Exception {
         Artifact artifact = stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
         ArtifactItem item = new ArtifactItem(artifact);
         item.setExcludes("**/*");
@@ -227,13 +229,15 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
         mojo.setArtifactItems(list);
         mojo.setExcludes("**/test2" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
-    public void testIncludeArtifactItemMultipleMarker() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testIncludeArtifactItemMultipleMarker(UnpackMojo mojo) throws Exception {
         List<ArtifactItem> list = new ArrayList<>();
         Artifact artifact = stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
         ArtifactItem item = new ArtifactItem(artifact);
@@ -246,14 +250,16 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
         list.add(item);
         mojo.setArtifactItems(list);
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
-        assertMarkerFiles(mojo.getArtifactItems(), true);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertMarkerFiles(mojo, mojo.getArtifactItems());
     }
 
-    public void testIncludeArtifactItemMultipleExecutions() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testIncludeArtifactItemMultipleExecutions(UnpackMojo mojo) throws Exception {
         List<ArtifactItem> list = new ArrayList<>();
         Artifact artifact = stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
         ArtifactItem item = new ArtifactItem(artifact);
@@ -266,11 +272,11 @@ public class TestIncludeExcludeUnpackMojo extends AbstractDependencyMojoTestCase
         list.add(item);
         mojo.setArtifactItems(list);
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
-        assertMarkerFiles(mojo.getArtifactItems(), true);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertMarkerFiles(mojo, mojo.getArtifactItems());
 
         // Now run again and make sure the extracted files haven't gotten overwritten
         File destFile2 =
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
index 4346ed94..06a53c12 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
@@ -18,83 +18,78 @@
  */
 package org.apache.maven.plugins.dependency.fromConfiguration;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.attribute.FileTime;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoExtension;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
 import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
 import org.apache.maven.plugins.dependency.utils.markers.UnpackFileMarkerHandler;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
-public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
+@MojoTest(realRepositorySession = true)
+@Basedir("/unit/unpack-dependencies-test")
+class TestUnpackMojo {
 
-    UnpackMojo mojo;
+    @TempDir
+    private File tempDir;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "unpack";
-    }
+    private DependencyArtifactStubFactory stubFactory;
 
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
+    @Inject
+    private MavenSession session;
 
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
-    }
+    @Inject
+    private MavenProject project;
+
+    @Inject
+    private ArchiverManager archiverManager;
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
-
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
-
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
-
-        File testPom = new File(getBasedir(), "target/test-classes/unit/unpack-test/plugin-config.xml");
-        mojo = (UnpackMojo) lookupMojo("unpack", testPom);
-        mojo.setOutputDirectory(new File(this.testDir, "outputDirectory"));
-        mojo.setMarkersDirectory(new File(this.testDir, "markers"));
-
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
-        // MavenProject project = mojo.getProject();
-        // init classifier things
-        // it needs to get the archivermanager
-        stubFactory.setUnpackableFile(lookup(ArchiverManager.class));
-        // i'm using one file repeatedly to archive so I can test the name
-        // programmatically.
-        stubFactory.setSrcFile(new File(
-                getBasedir() + File.separatorChar + "target/test-classes/unit/unpack-dependencies-test/test.txt"));
-
-        installLocalRepository(session.getRepositorySession());
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        stubFactory.setUnpackableFile(archiverManager);
+        stubFactory.setSrcFile(MojoExtension.getTestFile("test.txt"));
+
+        session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
+
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
     }
 
-    public ArtifactItem getSingleArtifactItem(boolean removeVersion) throws MojoExecutionException {
-        List<ArtifactItem> list = mojo.getProcessedArtifactItems(removeVersion);
+    private ArtifactItem getSingleArtifactItem(UnpackMojo mojo) throws MojoExecutionException {
+        List<ArtifactItem> list = mojo.getProcessedArtifactItems(false);
         return list.get(0);
     }
 
-    public void testGetArtifactItems() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testGetArtifactItems(UnpackMojo mojo) throws Exception {
 
         ArtifactItem item = new ArtifactItem();
 
@@ -107,52 +102,58 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
 
         mojo.setArtifactItems(list);
 
-        ArtifactItem result = getSingleArtifactItem(false);
+        ArtifactItem result = getSingleArtifactItem(mojo);
         assertEquals(mojo.getOutputDirectory(), result.getOutputDirectory());
 
         File output = new File(mojo.getOutputDirectory(), "override");
         item.setOutputDirectory(output);
-        result = getSingleArtifactItem(false);
+        result = getSingleArtifactItem(mojo);
         assertEquals(output, result.getOutputDirectory());
     }
 
-    public void assertMarkerFiles(Collection<ArtifactItem> items, boolean exist) {
+    private void assertMarkerFiles(UnpackMojo mojo, Collection<ArtifactItem> items, boolean exists) {
         for (ArtifactItem item : items) {
-            assertMarkerFile(exist, item);
+            assertMarkerFile(mojo, exists, item);
         }
     }
 
-    public void assertMarkerFile(boolean val, ArtifactItem item) {
+    private void assertMarkerFile(UnpackMojo mojo, boolean exists, ArtifactItem item) {
         UnpackFileMarkerHandler handle = new UnpackFileMarkerHandler(item, mojo.getMarkersDirectory());
         try {
-            assertEquals(val, handle.isMarkerSet());
+            assertEquals(exists, handle.isMarkerSet());
         } catch (MojoExecutionException e) {
             fail(e.getLongMessage());
         }
     }
 
-    public void testUnpackFile() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackFile(UnpackMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
 
         mojo.setArtifactItems(list);
 
         mojo.execute();
 
-        assertMarkerFiles(list, true);
+        assertMarkerFiles(mojo, list, true);
     }
 
-    public void testSkip() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    @MojoParameter(name = "skip", value = "true")
+    void testSkip(UnpackMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
 
-        mojo.setSkip(true);
         mojo.setArtifactItems(list);
 
         mojo.execute();
 
-        assertMarkerFiles(list, false);
+        assertMarkerFiles(mojo, list, false);
     }
 
-    public void testUnpackToLocation() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackToLocation(UnpackMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
         ArtifactItem item = list.get(0);
         item.setOutputDirectory(new File(mojo.getOutputDirectory(), "testOverride"));
@@ -161,10 +162,12 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        assertMarkerFiles(list, true);
+        assertMarkerFiles(mojo, list, true);
     }
 
-    public void testUnpackToLocationWhereLocationCannotBeCreatedThrowsException() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackToLocationWhereLocationCannotBeCreatedThrowsException(UnpackMojo mojo) throws Exception {
         List<ArtifactItem> list = stubFactory.getArtifactItems(stubFactory.getClassifiedArtifacts());
         ArtifactItem item = list.get(0);
         item.setOutputDirectory(new File(mojo.getOutputDirectory(), "testOverride"));
@@ -193,7 +196,9 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testMissingVersionNotFound() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testMissingVersionNotFound(UnpackMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -213,7 +218,7 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public List<Dependency> getDependencyList(ArtifactItem item) {
+    private List<Dependency> getDependencyList(ArtifactItem item) {
         Dependency dep = new Dependency();
         dep.setArtifactId(item.getArtifactId());
         dep.setClassifier(item.getClassifier());
@@ -235,7 +240,9 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         return list;
     }
 
-    public void testMissingVersionFromDependencies() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testMissingVersionFromDependencies(UnpackMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -251,11 +258,13 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         project.setDependencies(createArtifacts(getDependencyList(item)));
 
         mojo.execute();
-        assertMarkerFile(true, item);
+        assertMarkerFile(mojo, true, item);
         assertEquals("2.0-SNAPSHOT", item.getVersion());
     }
 
-    public void testMissingVersionFromDependenciesWithClassifier() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testMissingVersionFromDependenciesWithClassifier(UnpackMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -271,11 +280,11 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         project.setDependencies(createArtifacts(getDependencyList(item)));
 
         mojo.execute();
-        assertMarkerFile(true, item);
+        assertMarkerFile(mojo, true, item);
         assertEquals("2.1", item.getVersion());
     }
 
-    public List<Dependency> getDependencyMgtList(ArtifactItem item) {
+    private List<Dependency> getDependencyMgtList(ArtifactItem item) {
         Dependency dep = new Dependency();
         dep.setArtifactId(item.getArtifactId());
         dep.setClassifier(item.getClassifier());
@@ -297,7 +306,9 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         return list;
     }
 
-    public void testMissingVersionFromDependencyMgt() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testMissingVersionFromDependencyMgt(UnpackMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -320,14 +331,18 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
 
         mojo.setArtifactItems(list);
 
-        project.getDependencyManagement().setDependencies(createArtifacts(getDependencyMgtList(item)));
+        DependencyManagement dependencyManagement = new DependencyManagement();
+        dependencyManagement.setDependencies(createArtifacts(getDependencyMgtList(item)));
+        project.getModel().setDependencyManagement(dependencyManagement);
 
         mojo.execute();
-        assertMarkerFile(true, item);
+        assertMarkerFile(mojo, true, item);
         assertEquals("3.0-SNAPSHOT", item.getVersion());
     }
 
-    public void testMissingVersionFromDependencyMgtWithClassifier() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testMissingVersionFromDependencyMgtWithClassifier(UnpackMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -361,15 +376,19 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
 
         mojo.setArtifactItems(list);
 
-        project.getDependencyManagement().setDependencies(createArtifacts(getDependencyMgtList(item)));
+        DependencyManagement dependencyManagement = new DependencyManagement();
+        dependencyManagement.setDependencies(createArtifacts(getDependencyMgtList(item)));
+        project.getModel().setDependencyManagement(dependencyManagement);
 
         mojo.execute();
 
-        assertMarkerFile(true, item);
+        assertMarkerFile(mojo, true, item);
         assertEquals("3.1", item.getVersion());
     }
 
-    public void testArtifactNotFound() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testArtifactNotFound(UnpackMojo mojo) throws Exception {
         ArtifactItem item = new ArtifactItem();
 
         item.setArtifactId("artifactId");
@@ -390,7 +409,9 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testNoArtifactItems() {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testNoArtifactItems(UnpackMojo mojo) {
         try {
             mojo.getProcessedArtifactItems(false);
             fail("Expected Exception");
@@ -399,7 +420,9 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testUnpackDontOverWriteReleases() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackDontOverWriteReleases(UnpackMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact release = stubFactory.getReleaseArtifact();
         assertTrue(release.getFile().setLastModified(System.currentTimeMillis() - 2000));
@@ -414,10 +437,12 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        assertUnpacked(item, false);
+        assertUnpacked(mojo, item, false);
     }
 
-    public void testUnpackDontOverWriteSnapshots() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackDontOverWriteSnapshots(UnpackMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact artifact = stubFactory.getSnapshotArtifact();
         assertTrue(artifact.getFile().setLastModified(System.currentTimeMillis() - 2000));
@@ -432,10 +457,12 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        assertUnpacked(item, false);
+        assertUnpacked(mojo, item, false);
     }
 
-    public void testUnpackOverWriteReleases() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackOverWriteReleases(UnpackMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact release = stubFactory.getReleaseArtifact();
         assertTrue(release.getFile().setLastModified(System.currentTimeMillis() - 2000));
@@ -450,10 +477,12 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         mojo.setOverWriteReleases(true);
         mojo.execute();
 
-        assertUnpacked(item, true);
+        assertUnpacked(mojo, item, true);
     }
 
-    public void testUnpackOverWriteSnapshot() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackOverWriteSnapshot(UnpackMojo mojo) throws Exception {
         stubFactory.setCreateFiles(true);
         Artifact artifact = stubFactory.getSnapshotArtifact();
         assertTrue(artifact.getFile().setLastModified(System.currentTimeMillis() - 2000));
@@ -469,7 +498,7 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         mojo.setOverWriteSnapshots(true);
         mojo.execute();
 
-        assertUnpacked(item, true);
+        assertUnpacked(mojo, item, true);
     }
 
     /**
@@ -478,7 +507,9 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
      * https://bugs.openjdk.java.net/browse/JDK-8177809
      *
      */
-    public void testUnpackOverWriteIfNewer() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack")
+    void testUnpackOverWriteIfNewer(UnpackMojo mojo) throws Exception {
         final long now = System.currentTimeMillis();
 
         stubFactory.setCreateFiles(true);
@@ -510,19 +541,17 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        long markerLastModifiedMillis =
-                Files.getLastModifiedTime(marker.toPath()).toMillis();
-        long unpackedFileLastModifiedMillis =
-                Files.getLastModifiedTime(unpackedFile.toPath()).toMillis();
+        FileTime markerLastModifiedMillis = Files.getLastModifiedTime(marker.toPath());
+        FileTime unpackedFileLastModifiedMillis = Files.getLastModifiedTime(unpackedFile.toPath());
 
         assertNotEquals(
-                "unpackedFile '" + unpackedFile + "' lastModified() == " + markerLastModifiedMillis
-                        + ": should be different",
                 markerLastModifiedMillis,
-                unpackedFileLastModifiedMillis);
+                unpackedFileLastModifiedMillis,
+                "unpackedFile '" + unpackedFile + "' lastModified() == " + markerLastModifiedMillis
+                        + ": should be different");
     }
 
-    public void assertUnpacked(ArtifactItem item, boolean overWrite) throws Exception {
+    private void assertUnpacked(UnpackMojo mojo, ArtifactItem item, boolean overWrite) throws Exception {
 
         File unpackedFile = getUnpackedFile(item);
 
@@ -542,7 +571,7 @@ public class TestUnpackMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public File getUnpackedFile(ArtifactItem item) {
+    private File getUnpackedFile(ArtifactItem item) {
         File unpackedFile = new File(
                 item.getOutputDirectory(), DependencyArtifactStubFactory.getUnpackableFileName(item.getArtifact()));
 
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java
index 5726e35d..b800906f 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java
@@ -47,7 +47,7 @@ import static org.junit.jupiter.api.AssertionsKt.assertNull;
 import static org.mockito.Mockito.when;
 
 @MojoTest
-public class TestBuildClasspathMojo {
+class TestBuildClasspathMojo {
 
     @TempDir
     private File testDir;
@@ -63,7 +63,7 @@ public class TestBuildClasspathMojo {
      */
     @Test
     @InjectMojo(goal = "build-classpath")
-    public void testEnvironment(BuildClasspathMojo mojo) throws Exception {
+    void testEnvironment(BuildClasspathMojo mojo) throws Exception {
 
         Set<Artifact> artifacts = getArtifacts();
         when(project.getArtifacts()).thenReturn(artifacts);
@@ -113,7 +113,7 @@ public class TestBuildClasspathMojo {
 
     @Test
     @InjectMojo(goal = "build-classpath")
-    public void testPath(BuildClasspathMojo mojo) throws Exception {
+    void testPath(BuildClasspathMojo mojo) {
 
         File localRepo = new File(testDir, "local-rep").getAbsoluteFile();
 
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
index bd5043bd..5527f0d3 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
@@ -18,89 +18,74 @@
  */
 package org.apache.maven.plugins.dependency.fromDependencies;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
+import org.apache.maven.plugins.dependency.utils.CopyUtil;
 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
-import org.apache.maven.plugins.dependency.utils.ResolverUtil;
 import org.apache.maven.plugins.dependency.utils.markers.DefaultFileMarkerHandler;
 import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.RepositorySystem;
-
-public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
-
-    CopyDependenciesMojo mojo;
-
-    @Override
-    protected String getTestDirectoryName() {
-        return "copy-dependencies";
-    }
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
-
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
-    }
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+@MojoTest(realRepositorySession = true)
+class TestCopyDependenciesMojo {
 
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    @TempDir
+    private File tempDir;
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    private DependencyArtifactStubFactory stubFactory;
 
-        RepositorySystem repositorySystem = lookup(RepositorySystem.class);
-        ResolverUtil resolverUtil = new ResolverUtil(repositorySystem, () -> session);
-        getContainer().addComponent(resolverUtil, ResolverUtil.class.getName());
+    @Inject
+    private MavenSession session;
 
-        File testPom = new File(getBasedir(), "target/test-classes/unit/copy-dependencies-test/plugin-config.xml");
-        mojo = (CopyDependenciesMojo) lookupMojo("copy-dependencies", testPom);
-        mojo.outputDirectory = new File(this.testDir, "outputDirectory");
+    @Inject
+    private MavenProject project;
 
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
+    @Inject
+    private CopyUtil copyUtil;
 
-        LegacySupport legacySupport = lookup(LegacySupport.class);
-        legacySupport.setSession(session);
-        installLocalRepository(legacySupport);
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
 
-        Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
-        Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
+        Set<Artifact> artifacts = stubFactory.getScopedArtifacts();
+        Set<Artifact> directArtifacts = stubFactory.getReleaseAndSnapshotArtifacts();
         artifacts.addAll(directArtifacts);
-
         project.setArtifacts(artifacts);
-        mojo.markersDirectory = new File(this.testDir, "markers");
 
-        ArtifactHandlerManager manager = lookup(ArtifactHandlerManager.class);
-        setVariableValueToObject(mojo, "artifactHandlerManager", manager);
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
     }
 
-    public void assertNoMarkerFile(Artifact artifact) throws MojoExecutionException {
+    private void assertNoMarkerFile(CopyDependenciesMojo mojo, Artifact artifact) throws MojoExecutionException {
         DefaultFileMarkerHandler handle = new DefaultFileMarkerHandler(artifact, mojo.markersDirectory);
         assertFalse(handle.isMarkerSet());
     }
 
-    public void testCopyArtifactFile() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testCopyArtifactFile(CopyDependenciesMojo mojo) throws Exception {
         final Artifact srcArtifact = new ArtifactStub();
         srcArtifact.setGroupId("org.apache.maven.plugins");
         srcArtifact.setArtifactId("maven-dependency-plugin-dummy");
@@ -112,7 +97,7 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
 
         assertFalse(dest.exists());
 
-        copyArtifactFile(srcArtifact, dest);
+        copyUtil.copyArtifactFile(srcArtifact, dest);
         assertTrue(dest.exists());
     }
 
@@ -121,41 +106,38 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception if an error occurs during the test
      */
-    public void testCopySignatureFiles() throws Exception {
-        // Enable the copySignatures parameter
-        mojo.copySignatures = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "copySignatures", value = "true")
+    void testCopySignatureFiles(CopyDependenciesMojo mojo) throws Exception {
 
         if (!mojo.outputDirectory.exists()) {
-            assertTrue("Failed to create output directory", mojo.outputDirectory.mkdirs());
+            assertTrue(mojo.outputDirectory.mkdirs(), "Failed to create output directory");
         }
 
         File sourceDirectory =
                 new File(System.getProperty("java.io.tmpdir"), "test-source-" + System.currentTimeMillis());
         if (!sourceDirectory.exists()) {
-            assertTrue("Failed to create source directory", sourceDirectory.mkdirs());
+            assertTrue(sourceDirectory.mkdirs(), "Failed to create source directory");
         }
 
         File artifactFile = new File(sourceDirectory, "maven-dependency-plugin-1.0.jar");
         if (!artifactFile.getParentFile().exists()) {
-            assertTrue(
-                    "Failed to create parent directory",
-                    artifactFile.getParentFile().mkdirs());
+            assertTrue(artifactFile.getParentFile().mkdirs(), "Failed to create parent directory");
         }
         if (artifactFile.exists()) {
-            assertTrue("Failed to delete existing artifact file", artifactFile.delete());
+            assertTrue(artifactFile.delete(), "Failed to delete existing artifact file");
         }
-        assertTrue("Failed to create artifact file", artifactFile.createNewFile());
+        assertTrue(artifactFile.createNewFile(), "Failed to create artifact file");
 
         File signatureFile = new File(sourceDirectory, "maven-dependency-plugin-1.0.jar.asc");
         if (!signatureFile.getParentFile().exists()) {
-            assertTrue(
-                    "Failed to create parent directory",
-                    signatureFile.getParentFile().mkdirs());
+            assertTrue(signatureFile.getParentFile().mkdirs(), "Failed to create parent directory");
         }
         if (signatureFile.exists()) {
-            assertTrue("Failed to delete existing signature file", signatureFile.delete());
+            assertTrue(signatureFile.delete(), "Failed to delete existing signature file");
         }
-        assertTrue("Failed to create signature file", signatureFile.createNewFile());
+        assertTrue(signatureFile.createNewFile(), "Failed to create signature file");
 
         Artifact artifact = stubFactory.createArtifact(
                 "org.apache.maven.plugins", "maven-dependency-plugin", "1.0", Artifact.SCOPE_COMPILE);
@@ -168,7 +150,7 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         mojo.execute();
 
         File copiedSignatureFile = new File(mojo.outputDirectory, "maven-dependency-plugin-1.0.jar.asc");
-        assertTrue("Signature file was not copied", copiedSignatureFile.exists());
+        assertTrue(copiedSignatureFile.exists(), "Signature file was not copied");
 
         // Clean up
         artifactFile.delete();
@@ -181,7 +163,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of an error
      */
-    public void testMojo() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testMojo(CopyDependenciesMojo mojo) throws Exception {
         mojo.execute();
         Set<Artifact> artifacts = mojo.getProject().getArtifacts();
         for (Artifact artifact : artifacts) {
@@ -190,12 +174,14 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
             assertTrue(file.exists());
 
             // there should be no markers for the copy mojo
-            assertNoMarkerFile(artifact);
+            assertNoMarkerFile(mojo, artifact);
         }
     }
 
-    public void testStripVersion() throws Exception {
-        mojo.stripVersion = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "stripVersion", value = "true")
+    void testStripVersion(CopyDependenciesMojo mojo) throws Exception {
         mojo.execute();
 
         Set<Artifact> artifacts = mojo.getProject().getArtifacts();
@@ -206,8 +192,10 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testStripClassifier() throws Exception {
-        mojo.stripClassifier = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "stripClassifier", value = "true")
+    void testStripClassifier(CopyDependenciesMojo mojo) throws Exception {
         mojo.execute();
 
         Set<Artifact> artifacts = mojo.getProject().getArtifacts();
@@ -218,8 +206,10 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testUseBaseVersion() throws Exception {
-        mojo.useBaseVersion = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useBaseVersion", value = "true")
+    void testUseBaseVersion(CopyDependenciesMojo mojo) throws Exception {
         mojo.execute();
 
         Set<Artifact> artifacts = mojo.getProject().getArtifacts();
@@ -230,8 +220,10 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testNoTransitive() throws Exception {
-        mojo.excludeTransitive = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "excludeTransitive", value = "true")
+    void testNoTransitive(CopyDependenciesMojo mojo) throws Exception {
         mojo.execute();
 
         Set<Artifact> artifacts = mojo.getProject().getArtifacts();
@@ -242,10 +234,12 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeType() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "excludeTypes", value = "jar")
+    void testExcludeType(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
 
-        mojo.excludeTypes = "jar";
         mojo.execute();
 
         Set<Artifact> artifacts = mojo.getProject().getArtifacts();
@@ -256,11 +250,13 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testIncludeType() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "includeTypes", value = "jar")
+    @MojoParameter(name = "excludeTypes", value = "jar")
+    void testIncludeType(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
 
-        mojo.includeTypes = "jar";
-        mojo.excludeTypes = "jar";
         // shouldn't get anything.
 
         mojo.execute();
@@ -283,9 +279,11 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeArtifactId() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "excludeArtifactIds", value = "one")
+    void testExcludeArtifactId(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getArtifactArtifacts());
-        mojo.excludeArtifactIds = "one";
         mojo.execute();
 
         Set<Artifact> artifacts = mojo.getProject().getArtifacts();
@@ -296,7 +294,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testIncludeArtifactId() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testIncludeArtifactId(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getArtifactArtifacts());
 
         mojo.includeArtifactIds = "one";
@@ -323,7 +323,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testIncludeGroupId() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testIncludeGroupId(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
 
         mojo.includeGroupIds = "one";
@@ -350,7 +352,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeGroupId() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeGroupId(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
 
         mojo.excludeGroupIds = "one";
@@ -365,7 +369,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeMultipleGroupIds() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeMultipleGroupIds(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
 
         mojo.excludeGroupIds = "one,two";
@@ -381,7 +387,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeClassifier() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeClassifier(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getClassifiedArtifacts());
 
         mojo.excludeClassifiers = "one";
@@ -395,7 +403,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testIncludeClassifier() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testIncludeClassifier(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getClassifiedArtifacts());
 
         mojo.includeClassifiers = "one";
@@ -422,7 +432,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerType() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testSubPerType(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
 
         mojo.useSubDirectoryPerType = true;
@@ -438,19 +450,26 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testCDMClassifier() throws Exception {
-        dotestClassifierType("jdk14", null);
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testCDMClassifier(CopyDependenciesMojo mojo) throws Exception {
+        dotestClassifierType(mojo, "jdk14", null);
     }
 
-    public void testCDMType() throws Exception {
-        dotestClassifierType(null, "sources");
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testCDMType(CopyDependenciesMojo mojo) throws Exception {
+        dotestClassifierType(mojo, null, "sources");
     }
 
-    public void testCDMClassifierType() throws Exception {
-        dotestClassifierType("jdk14", "sources");
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testCDMClassifierType(CopyDependenciesMojo mojo) throws Exception {
+        dotestClassifierType(mojo, "jdk14", "sources");
     }
 
-    public void dotestClassifierType(String testClassifier, String testType) throws Exception {
+    private void dotestClassifierType(CopyDependenciesMojo mojo, String testClassifier, String testType)
+            throws Exception {
         mojo.classifier = testClassifier;
         mojo.type = testType;
 
@@ -488,15 +507,17 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
             }
 
             // there should be no markers for the copy mojo
-            assertNoMarkerFile(artifact);
+            assertNoMarkerFile(mojo, artifact);
         }
     }
 
-    public void testArtifactResolutionException() throws MojoFailureException {
-        dotestArtifactExceptions();
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testArtifactResolutionException(CopyDependenciesMojo mojo) throws MojoFailureException {
+        dotestArtifactExceptions(mojo);
     }
 
-    public void dotestArtifactExceptions() throws MojoFailureException {
+    private void dotestArtifactExceptions(CopyDependenciesMojo mojo) throws MojoFailureException {
         mojo.classifier = "jdk";
         mojo.failOnMissingClassifierArtifact = true;
         mojo.type = "java-sources";
@@ -515,7 +536,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
      * File.separatorChar + "target/test-classes/unit/copy-dependencies-test/test.zip" ); }
      */
 
-    public void testDontOverWriteRelease()
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testDontOverWriteRelease(CopyDependenciesMojo mojo)
             throws MojoExecutionException, InterruptedException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
@@ -544,7 +567,10 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         assertEquals(time, copiedFile.lastModified());
     }
 
-    public void testOverWriteRelease() throws MojoExecutionException, IOException, MojoFailureException {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testOverWriteRelease(CopyDependenciesMojo mojo)
+            throws MojoExecutionException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
         Artifact release = stubFactory.getReleaseArtifact();
@@ -572,7 +598,10 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         assertEquals(1000L, timeCopyNow);
     }
 
-    public void testDontOverWriteSnap() throws MojoExecutionException, IOException, MojoFailureException {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testDontOverWriteSnap(CopyDependenciesMojo mojo)
+            throws MojoExecutionException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
         Artifact snap = stubFactory.getSnapshotArtifact();
@@ -600,7 +629,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         assertEquals(2000L, timeCopyNow);
     }
 
-    public void testOverWriteSnap() throws MojoExecutionException, IOException, MojoFailureException {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testOverWriteSnap(CopyDependenciesMojo mojo) throws MojoExecutionException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
         Artifact snap = stubFactory.getSnapshotArtifact();
@@ -629,12 +660,16 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         assertEquals(1000L, timeCopyNow);
     }
 
-    public void testGetDependencies() throws MojoExecutionException {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testGetDependencies(CopyDependenciesMojo mojo) throws MojoExecutionException {
         assertTrue(mojo.getResolvedDependencies(true)
                 .containsAll(mojo.getDependencySets(true).getResolvedDependencies()));
     }
 
-    public void testExcludeProvidedScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeProvidedScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
 
         mojo.excludeScope = "provided";
@@ -651,7 +686,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeSystemScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeSystemScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
 
         mojo.excludeScope = "system";
@@ -668,7 +705,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeCompileScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeCompileScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
 
         mojo.excludeScope = "compile";
@@ -684,7 +723,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeTestScope() throws IOException, MojoFailureException {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeTestScope(CopyDependenciesMojo mojo) throws IOException, MojoFailureException {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
 
         mojo.excludeScope = "test";
@@ -697,7 +738,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeRuntimeScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testExcludeRuntimeScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
 
         mojo.excludeScope = "runtime";
@@ -713,7 +756,9 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testCopyPom() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testCopyPom(CopyDependenciesMojo mojo) throws Exception {
         mojo.setCopyPom(true);
 
         Set<Artifact> set = new HashSet<>();
@@ -726,11 +771,13 @@ public class TestCopyDependenciesMojo extends AbstractDependencyMojoTestCase {
         for (Artifact artifact : artifacts) {
             String fileName = DependencyUtil.getFormattedFileName(artifact, false);
             File file = new File(mojo.outputDirectory, fileName.substring(0, fileName.length() - 4) + ".pom");
-            assertTrue(file + " doesn't exist", file.exists());
+            assertTrue(file.exists(), file + " doesn't exist");
         }
     }
 
-    public void testPrependGroupId() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testPrependGroupId(CopyDependenciesMojo mojo) throws Exception {
         mojo.prependGroupId = true;
         mojo.execute();
 
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
index ae53378f..a04ff76b 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.plugins.dependency.fromDependencies;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -26,6 +28,9 @@ import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -38,65 +43,55 @@ import org.apache.maven.artifact.repository.metadata.Snapshot;
 import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.bridge.MavenRepositorySystem;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.LegacySupport;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
-import org.apache.maven.plugins.dependency.utils.ResolverUtil;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.RepositorySystem;
-
-public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-    private CopyDependenciesMojo mojo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.when;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "copy-dependencies";
-    }
+@MojoTest(realRepositorySession = true)
+class TestCopyDependenciesMojo2 {
 
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
+    @TempDir
+    private File tempDir;
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    private DependencyArtifactStubFactory stubFactory;
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    @Inject
+    private MavenSession session;
 
-        RepositorySystem repositorySystem = lookup(RepositorySystem.class);
-        ResolverUtil resolverUtil = new ResolverUtil(repositorySystem, () -> session);
-        getContainer().addComponent(resolverUtil, ResolverUtil.class.getName());
+    @Inject
+    private MavenProject project;
 
-        File testPom = new File(getBasedir(), "target/test-classes/unit/copy-dependencies-test/plugin-config.xml");
-        mojo = (CopyDependenciesMojo) lookupMojo("copy-dependencies", testPom);
-        mojo.outputDirectory = new File(this.testDir, "outputDirectory");
+    @Inject
+    private MavenRepositorySystem repositorySystem;
 
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
 
-        Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
-        Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
+        Set<Artifact> artifacts = stubFactory.getScopedArtifacts();
+        Set<Artifact> directArtifacts = stubFactory.getReleaseAndSnapshotArtifacts();
         artifacts.addAll(directArtifacts);
-
         project.setArtifacts(artifacts);
-        mojo.markersDirectory = new File(this.testDir, "markers");
 
-        LegacySupport legacySupport = lookup(LegacySupport.class);
-        legacySupport.setSession(session);
-        installLocalRepository(legacySupport);
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
     }
 
-    public void testCopyDependenciesMojoIncludeCompileScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "includeScope", value = "compile")
+    void testCopyDependenciesMojoIncludeCompileScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
-        mojo.includeScope = "compile";
 
         mojo.execute();
 
@@ -111,9 +106,11 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testCopyDependenciesMojoIncludeTestScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "includeScope", value = "test")
+    void testCopyDependenciesMojoIncludeTestScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
-        mojo.includeScope = "test";
 
         mojo.execute();
 
@@ -128,9 +125,11 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testCopyDependenciesMojoIncludeRuntimeScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "includeScope", value = "runtime")
+    void testCopyDependenciesMojoIncludeRuntimeScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
-        mojo.includeScope = "runtime";
 
         mojo.execute();
 
@@ -145,9 +144,11 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testCopyDependenciesMojoIncludeprovidedScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "includeScope", value = "provided")
+    void testCopyDependenciesMojoIncludeprovidedScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
-        mojo.includeScope = "provided";
 
         mojo.execute();
 
@@ -160,9 +161,11 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testCopyDependenciesMojoIncludesystemScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "includeScope", value = "system")
+    void testCopyDependenciesMojoIncludesystemScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
-        mojo.includeScope = "system";
 
         mojo.execute();
 
@@ -175,8 +178,10 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerArtifact() throws Exception {
-        mojo.useSubDirectoryPerArtifact = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useSubDirectoryPerArtifact", value = "true")
+    void testSubPerArtifact(CopyDependenciesMojo mojo) throws Exception {
 
         mojo.execute();
 
@@ -190,10 +195,12 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerArtifactAndType() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useSubDirectoryPerArtifact", value = "true")
+    @MojoParameter(name = "useSubDirectoryPerType", value = "true")
+    void testSubPerArtifactAndType(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
-        mojo.useSubDirectoryPerArtifact = true;
-        mojo.useSubDirectoryPerType = true;
 
         mojo.execute();
 
@@ -207,10 +214,12 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerArtifactAndScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useSubDirectoryPerArtifact", value = "true")
+    @MojoParameter(name = "useSubDirectoryPerScope", value = "true")
+    void testSubPerArtifactAndScope(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
-        mojo.useSubDirectoryPerArtifact = true;
-        mojo.useSubDirectoryPerScope = true;
 
         mojo.execute();
 
@@ -224,7 +233,14 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testRepositoryLayout() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    void testRepositoryLayout(CopyDependenciesMojo mojo) throws Exception {
+
+        ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest();
+        pbr.setRepositorySession(session.getRepositorySession());
+        when(session.getProjectBuildingRequest()).thenReturn(pbr);
+
         String baseVersion = "2.0-SNAPSHOT";
         String groupId = "testGroupId";
         String artifactId = "expanded-snapshot";
@@ -253,8 +269,6 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         File baseDirectory = Paths.get(targetRepository.getBasedir()).toFile();
         assertTrue(baseDirectory.isDirectory());
 
-        org.apache.maven.repository.RepositorySystem repositorySystem =
-                lookup(org.apache.maven.repository.RepositorySystem.class);
         for (Artifact artifact : artifacts) {
             assertArtifactExists(artifact, targetRepository);
             if (!artifact.getBaseVersion().equals(artifact.getVersion())) {
@@ -296,9 +310,9 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         File file = new File(targetRepository.getBasedir(), pathOf);
 
         Path targetPath = Paths.get(file.getParent());
-        assertTrue("Target path doesn't exist: " + targetPath, Files.isDirectory(targetPath));
+        assertTrue(Files.isDirectory(targetPath), "Target path doesn't exist: " + targetPath);
 
-        assertTrue("File doesn't exist: " + file.getAbsolutePath(), file.exists());
+        assertTrue(file.exists(), "File doesn't exist: " + file.getAbsolutePath());
 
         Collection<ArtifactMetadata> metas = artifact.getMetadataList();
         for (ArtifactMetadata meta : metas) {
@@ -308,9 +322,11 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerArtifactRemoveVersion() throws Exception {
-        mojo.useSubDirectoryPerArtifact = true;
-        mojo.stripVersion = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useSubDirectoryPerArtifact", value = "true")
+    @MojoParameter(name = "stripVersion", value = "true")
+    void testSubPerArtifactRemoveVersion(CopyDependenciesMojo mojo) throws Exception {
 
         mojo.execute();
 
@@ -324,11 +340,13 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerArtifactAndTypeRemoveVersion() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useSubDirectoryPerArtifact", value = "true")
+    @MojoParameter(name = "useSubDirectoryPerType", value = "true")
+    @MojoParameter(name = "stripVersion", value = "true")
+    void testSubPerArtifactAndTypeRemoveVersion(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
-        mojo.useSubDirectoryPerArtifact = true;
-        mojo.useSubDirectoryPerType = true;
-        mojo.stripVersion = true;
 
         mojo.execute();
 
@@ -342,9 +360,11 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerArtifactRemoveType() throws Exception {
-        mojo.useSubDirectoryPerArtifact = true;
-        mojo.stripType = true;
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useSubDirectoryPerArtifact", value = "true")
+    @MojoParameter(name = "stripType", value = "true")
+    void testSubPerArtifactRemoveType(CopyDependenciesMojo mojo) throws Exception {
 
         mojo.execute();
 
@@ -358,11 +378,13 @@ public class TestCopyDependenciesMojo2 extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testSubPerArtifactAndTypeRemoveType() throws Exception {
+    @Test
+    @InjectMojo(goal = "copy-dependencies")
+    @MojoParameter(name = "useSubDirectoryPerArtifact", value = "true")
+    @MojoParameter(name = "useSubDirectoryPerType", value = "true")
+    @MojoParameter(name = "stripType", value = "true")
+    void testSubPerArtifactAndTypeRemoveType(CopyDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArtifacts());
-        mojo.useSubDirectoryPerArtifact = true;
-        mojo.useSubDirectoryPerType = true;
-        mojo.stripType = true;
 
         mojo.execute();
 
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java
index eeb09381..b87cc6a1 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java
@@ -18,70 +18,53 @@
  */
 package org.apache.maven.plugins.dependency.fromDependencies;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoExtension;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-public class TestIncludeExcludeUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
-    private static final String PACKED_FILE = "test.zip";
-
-    private static final String UNPACKED_FILE_PREFIX = "test";
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-    private static final String UNPACKED_FILE_SUFFIX = ".txt";
+@MojoTest
+@Basedir("/unit/unpack-dependencies-test")
+class TestIncludeExcludeUnpackDependenciesMojo {
+    @TempDir
+    private File tempDir;
 
-    private static final String PACKED_FILE_PATH = "target/test-classes/unit/unpack-dependencies-test/" + PACKED_FILE;
+    @Inject
+    private MavenSession session;
 
-    private UnpackDependenciesMojo mojo;
+    @Inject
+    private MavenProject project;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "unpack-dependencies";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
-
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
-
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
-
-        File testPom = new File(getBasedir(), "target/test-classes/unit/unpack-dependencies-test/plugin-config.xml");
-        mojo = (UnpackDependenciesMojo) lookupMojo("unpack-dependencies", testPom);
-        mojo.outputDirectory = new File(this.testDir, "outputDirectory");
+    private static final String UNPACKED_FILE_PREFIX = "test";
 
-        // it needs to get the archivermanager
-        // stubFactory.setUnpackableFile( mojo.getArchiverManager() );
-        // I'm using one file repeatedly to archive so I can test the name
-        // programmatically.
-        stubFactory.setSrcFile(new File(getBasedir() + File.separatorChar + PACKED_FILE_PATH));
+    private static final String UNPACKED_FILE_SUFFIX = ".txt";
 
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
+    @BeforeEach
+    void setUp() throws Exception {
+        DependencyArtifactStubFactory stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        stubFactory.setSrcFile(MojoExtension.getTestFile("test.zip"));
 
-        Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
-        Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
-        artifacts.addAll(directArtifacts);
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
 
+        Set<Artifact> artifacts = stubFactory.getScopedArtifacts();
         project.setArtifacts(artifacts);
-        project.setDependencyArtifacts(directArtifacts);
-        mojo.markersDirectory = new File(this.testDir, "markers");
     }
 
-    private void assertUnpacked(boolean unpacked, String fileName) {
+    private void assertUnpacked(UnpackDependenciesMojo mojo, boolean unpacked, String fileName) {
         File destFile = new File(mojo.getOutputDirectory().getAbsolutePath(), fileName);
         assertEquals(unpacked, destFile.exists());
     }
@@ -91,13 +74,15 @@ public class TestIncludeExcludeUnpackDependenciesMojo extends AbstractDependency
      *
      * @throws Exception in case of errors
      */
-    public void testUnpackIncludesManyFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testUnpackIncludesManyFiles(UnpackDependenciesMojo mojo) throws Exception {
         mojo.setIncludes("**/*1" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -105,13 +90,15 @@ public class TestIncludeExcludeUnpackDependenciesMojo extends AbstractDependency
      *
      * @throws Exception in case of errors
      */
-    public void testUnpackIncludesSingleFile() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testUnpackIncludesSingleFile(UnpackDependenciesMojo mojo) throws Exception {
         mojo.setIncludes("**/test2" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -119,13 +106,15 @@ public class TestIncludeExcludeUnpackDependenciesMojo extends AbstractDependency
      *
      * @throws Exception in case of errors
      */
-    public void testUnpackIncludesAllFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testUnpackIncludesAllFiles(UnpackDependenciesMojo mojo) throws Exception {
         mojo.setIncludes("**/*");
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -133,13 +122,15 @@ public class TestIncludeExcludeUnpackDependenciesMojo extends AbstractDependency
      *
      * @throws Exception in case of errors
      */
-    public void testUnpackExcludesManyFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testUnpackExcludesManyFiles(UnpackDependenciesMojo mojo) throws Exception {
         mojo.setExcludes("**/*1" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -147,13 +138,15 @@ public class TestIncludeExcludeUnpackDependenciesMojo extends AbstractDependency
      *
      * @throws Exception in case of errors
      */
-    public void testUnpackExcludesSingleFile() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testUnpackExcludesSingleFile(UnpackDependenciesMojo mojo) throws Exception {
         mojo.setExcludes("**/test2" + UNPACKED_FILE_SUFFIX);
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
     /**
@@ -161,20 +154,24 @@ public class TestIncludeExcludeUnpackDependenciesMojo extends AbstractDependency
      *
      * @throws Exception in case of errors
      */
-    public void testUnpackExcludesAllFiles() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testUnpackExcludesAllFiles(UnpackDependenciesMojo mojo) throws Exception {
         mojo.setExcludes("**/*");
         mojo.execute();
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 
-    public void testNoIncludeExcludes() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testNoIncludeExcludes(UnpackDependenciesMojo mojo) throws Exception {
         mojo.execute();
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
-        assertUnpacked(true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX);
+        assertUnpacked(mojo, true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX);
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestRenderDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestRenderDependenciesMojo.java
index c42da77d..bf3119be 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestRenderDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestRenderDependenciesMojo.java
@@ -18,46 +18,40 @@
  */
 package org.apache.maven.plugins.dependency.fromDependencies;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class TestRenderDependenciesMojo extends AbstractDependencyMojoTestCase {
-    private RenderDependenciesMojo mojo;
-
-    @Override
-    protected String getTestDirectoryName() {
-        return "render-dependencies";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
+@MojoTest
+class TestRenderDependenciesMojo {
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    private DependencyArtifactStubFactory stubFactory;
 
-        final MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    @TempDir
+    private File tempDir;
 
-        final MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    @Inject
+    private MavenProject project;
 
-        final File testPom = new File(
-                getBasedir(), "target/test-classes/unit/" + getTestDirectoryName() + "-test/plugin-config.xml");
-        mojo = (RenderDependenciesMojo) lookupMojo(getTestDirectoryName(), testPom);
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(null, false);
+        setupProject();
     }
 
     /**
@@ -66,10 +60,10 @@ public class TestRenderDependenciesMojo extends AbstractDependencyMojoTestCase {
      * It is useful when combined with JIB for example since several versions of the CRD do not support wildcard for
      * the classpath(s).
      */
-    public void testRender() throws Exception {
-        final File rendered = new File(testDir, "render-dependencies.testRender.txt");
-
-        setupProject();
+    @Test
+    @InjectMojo(goal = "render-dependencies")
+    void testRender(RenderDependenciesMojo mojo) throws Exception {
+        final File rendered = new File(tempDir, "render-dependencies.testRender.txt");
 
         mojo.setTemplate("deps:\n"
                 + "  jars:\n"
@@ -103,9 +97,11 @@ public class TestRenderDependenciesMojo extends AbstractDependencyMojoTestCase {
     /**
      * Tests the rendering with a file template.
      */
-    public void testRenderFromFile() throws Exception {
-        final File rendered = new File(testDir, "render-dependencies.testRenderFromFile.txt");
-        final File template = new File(testDir, "render-dependencies.testRenderFromFile.template.vm");
+    @Test
+    @InjectMojo(goal = "render-dependencies")
+    void testRenderFromFile(RenderDependenciesMojo mojo) throws Exception {
+        final File rendered = new File(tempDir, "render-dependencies.testRenderFromFile.txt");
+        final File template = new File(tempDir, "render-dependencies.testRenderFromFile.template.vm");
         Files.write(
                 template.toPath(),
                 ("deps:\n"
@@ -143,11 +139,11 @@ public class TestRenderDependenciesMojo extends AbstractDependencyMojoTestCase {
     }
 
     private void setupProject() throws IOException {
-        final MavenProject project = mojo.getProject();
         final Set<Artifact> artifacts = stubFactory.getScopedArtifacts();
         final Set<Artifact> directArtifacts = stubFactory.getReleaseAndSnapshotArtifacts();
         artifacts.addAll(directArtifacts);
         project.setArtifacts(artifacts);
         project.setDependencyArtifacts(directArtifacts);
+        project.setArtifact(stubFactory.createArtifact("g", "a", "1.0", "jar"));
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java
index 98ddc813..453322c4 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java
@@ -18,101 +18,80 @@
  */
 package org.apache.maven.plugins.dependency.fromDependencies;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoExtension;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
 import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
-import org.apache.maven.plugins.dependency.utils.ResolverUtil;
 import org.apache.maven.plugins.dependency.utils.markers.DefaultFileMarkerHandler;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
-import org.eclipse.aether.RepositorySystem;
-
-public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-    private static final String UNPACKABLE_FILE = "test.txt";
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
 
-    private static final String UNPACKABLE_FILE_PATH =
-            "target/test-classes/unit/unpack-dependencies-test/" + UNPACKABLE_FILE;
+@MojoTest(realRepositorySession = true)
+@Basedir("/unit/unpack-dependencies-test")
+class TestUnpackDependenciesMojo {
 
-    UnpackDependenciesMojo mojo;
+    @TempDir
+    private File tempDir;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "unpack-dependencies";
-    }
+    private DependencyArtifactStubFactory stubFactory;
 
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
-
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
-    }
+    @Inject
+    private MavenSession session;
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+    @Inject
+    private MavenProject project;
 
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    @Inject
+    private ArchiverManager archiverManager;
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
-
-        RepositorySystem repositorySystem = lookup(RepositorySystem.class);
-        ResolverUtil resolverUtil = new ResolverUtil(repositorySystem, () -> session);
-        getContainer().addComponent(resolverUtil, ResolverUtil.class.getName());
+    private static final String UNPACKABLE_FILE = "test.txt";
 
-        File testPom = new File(getBasedir(), "target/test-classes/unit/unpack-dependencies-test/plugin-config.xml");
-        mojo = (UnpackDependenciesMojo) lookupMojo("unpack-dependencies", testPom);
-        mojo.outputDirectory = new File(this.testDir, "outputDirectory");
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
 
         // it needs to get the archivermanager
-        stubFactory.setUnpackableFile(lookup(ArchiverManager.class));
+        stubFactory.setUnpackableFile(archiverManager);
         // i'm using one file repeatedly to archive so I can test the name
         // programmatically.
-        stubFactory.setSrcFile(new File(getBasedir() + File.separatorChar + UNPACKABLE_FILE_PATH));
-
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
-
-        LegacySupport legacySupport = lookup(LegacySupport.class);
-        legacySupport.setSession(session);
-        installLocalRepository(legacySupport);
+        stubFactory.setSrcFile(MojoExtension.getTestFile(UNPACKABLE_FILE));
 
         Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
         Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
         artifacts.addAll(directArtifacts);
 
         project.setArtifacts(artifacts);
-        mojo.markersDirectory = new File(this.testDir, "markers");
 
-        ArtifactHandlerManager manager = lookup(ArtifactHandlerManager.class);
-        setVariableValueToObject(mojo, "artifactHandlerManager", manager);
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
     }
 
-    public void assertUnpacked(Artifact artifact) {
-        assertUnpacked(true, artifact);
+    private void assertUnpacked(UnpackDependenciesMojo mojo, Artifact artifact) {
+        assertUnpacked(mojo, true, artifact);
     }
 
-    public void assertUnpacked(boolean val, Artifact artifact) {
+    private void assertUnpacked(UnpackDependenciesMojo mojo, boolean exists, Artifact artifact) {
         File folder = DependencyUtil.getFormattedOutputDirectory(
                 mojo.useSubDirectoryPerScope,
                 mojo.useSubDirectoryPerType,
@@ -125,78 +104,92 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
 
         File destFile = new File(folder, DependencyArtifactStubFactory.getUnpackableFileName(artifact));
 
-        assertEquals(val, destFile.exists());
-        assertMarkerFile(val, artifact);
+        assertEquals(exists, destFile.exists());
+        assertMarkerFile(mojo, exists, artifact);
     }
 
-    public void assertMarkerFile(boolean val, Artifact artifact) {
+    private void assertMarkerFile(UnpackDependenciesMojo mojo, boolean exists, Artifact artifact) {
         DefaultFileMarkerHandler handle = new DefaultFileMarkerHandler(artifact, mojo.markersDirectory);
         try {
-            assertEquals(val, handle.isMarkerSet());
+            assertEquals(exists, handle.isMarkerSet());
         } catch (MojoExecutionException e) {
             fail(e.getLongMessage());
         }
     }
 
-    public void testMojo() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testMojo(UnpackDependenciesMojo mojo) throws Exception {
         mojo.execute();
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(artifact);
+            assertUnpacked(mojo, artifact);
         }
     }
 
-    public void testNoTransitive() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testNoTransitive(UnpackDependenciesMojo mojo) throws Exception {
         mojo.excludeTransitive = true;
         mojo.execute();
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(artifact);
+            assertUnpacked(mojo, artifact);
         }
     }
 
-    public void testExcludeType() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeType(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArchiveArtifacts());
         mojo.excludeTypes = "jar";
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(!artifact.getType().equalsIgnoreCase("jar"), artifact);
+            assertUnpacked(mojo, !artifact.getType().equalsIgnoreCase("jar"), artifact);
         }
     }
 
-    public void testExcludeProvidedScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeProvidedScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.excludeScope = "provided";
 
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(!artifact.getScope().equals("provided"), artifact);
+            assertUnpacked(mojo, !artifact.getScope().equals("provided"), artifact);
         }
     }
 
-    public void testExcludeSystemScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeSystemScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.excludeScope = "system";
 
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(!artifact.getScope().equals("system"), artifact);
+            assertUnpacked(mojo, !artifact.getScope().equals("system"), artifact);
         }
     }
 
-    public void testExcludeCompileScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeCompileScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.excludeScope = "compile";
         mojo.execute();
         ScopeArtifactFilter saf = new ScopeArtifactFilter(mojo.excludeScope);
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(!saf.include(artifact), artifact);
+            assertUnpacked(mojo, !saf.include(artifact), artifact);
         }
     }
 
-    public void testExcludeTestScope() throws IOException, MojoFailureException {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeTestScope(UnpackDependenciesMojo mojo) throws IOException, MojoFailureException {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.excludeScope = "test";
 
@@ -208,18 +201,22 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         }
     }
 
-    public void testExcludeRuntimeScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeRuntimeScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.excludeScope = "runtime";
         mojo.execute();
         ScopeArtifactFilter saf = new ScopeArtifactFilter(mojo.excludeScope);
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(!saf.include(artifact), artifact);
+            assertUnpacked(mojo, !saf.include(artifact), artifact);
         }
     }
 
-    public void testIncludeType() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludeType(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArchiveArtifacts());
 
         mojo.includeTypes = "jar";
@@ -232,7 +229,7 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         while (iter.hasNext()) {
             Artifact artifact = iter.next();
 
-            assertUnpacked(false, artifact);
+            assertUnpacked(mojo, false, artifact);
         }
 
         mojo.excludeTypes = "";
@@ -242,51 +239,61 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         while (iter.hasNext()) {
             Artifact artifact = iter.next();
 
-            assertUnpacked(artifact.getType().equalsIgnoreCase("jar"), artifact);
+            assertUnpacked(mojo, artifact.getType().equalsIgnoreCase("jar"), artifact);
         }
     }
 
-    public void testSubPerType() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testSubPerType(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArchiveArtifacts());
         mojo.useSubDirectoryPerType = true;
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(artifact);
+            assertUnpacked(mojo, artifact);
         }
     }
 
-    public void testSubPerArtifact() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testSubPerArtifact(UnpackDependenciesMojo mojo) throws Exception {
         mojo.useSubDirectoryPerArtifact = true;
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(artifact);
+            assertUnpacked(mojo, artifact);
         }
     }
 
-    public void testSubPerArtifactAndType() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testSubPerArtifactAndType(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArchiveArtifacts());
         mojo.useSubDirectoryPerArtifact = true;
         mojo.useSubDirectoryPerType = true;
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(artifact);
+            assertUnpacked(mojo, artifact);
         }
     }
 
-    public void testSubPerArtifactRemoveVersion() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testSubPerArtifactRemoveVersion(UnpackDependenciesMojo mojo) throws Exception {
         mojo.useSubDirectoryPerArtifact = true;
         mojo.stripVersion = true;
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(artifact);
+            assertUnpacked(mojo, artifact);
         }
     }
 
-    public void testSubPerArtifactAndTypeRemoveVersion() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testSubPerArtifactAndTypeRemoveVersion(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getTypedArchiveArtifacts());
         mojo.useSubDirectoryPerArtifact = true;
         mojo.useSubDirectoryPerType = true;
@@ -294,22 +301,26 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(artifact);
+            assertUnpacked(mojo, artifact);
         }
     }
 
-    public void testIncludeCompileScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludeCompileScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.includeScope = "compile";
         mojo.execute();
         ScopeArtifactFilter saf = new ScopeArtifactFilter(mojo.includeScope);
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(saf.include(artifact), artifact);
+            assertUnpacked(mojo, saf.include(artifact), artifact);
         }
     }
 
-    public void testIncludeTestScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludeTestScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.includeScope = "test";
 
@@ -317,43 +328,51 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         ScopeArtifactFilter saf = new ScopeArtifactFilter(mojo.includeScope);
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(saf.include(artifact), artifact);
+            assertUnpacked(mojo, saf.include(artifact), artifact);
         }
     }
 
-    public void testIncludeRuntimeScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludeRuntimeScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.includeScope = "runtime";
         mojo.execute();
         ScopeArtifactFilter saf = new ScopeArtifactFilter(mojo.includeScope);
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(saf.include(artifact), artifact);
+            assertUnpacked(mojo, saf.include(artifact), artifact);
         }
     }
 
-    public void testIncludeprovidedScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludeprovidedScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.includeScope = "provided";
 
         mojo.execute();
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(Artifact.SCOPE_PROVIDED.equals(artifact.getScope()), artifact);
+            assertUnpacked(mojo, Artifact.SCOPE_PROVIDED.equals(artifact.getScope()), artifact);
         }
     }
 
-    public void testIncludesystemScope() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludesystemScope(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getScopedArtifacts());
         mojo.includeScope = "system";
 
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(Artifact.SCOPE_SYSTEM.equals(artifact.getScope()), artifact);
+            assertUnpacked(mojo, Artifact.SCOPE_SYSTEM.equals(artifact.getScope()), artifact);
         }
     }
 
-    public void testIncludeArtifactId() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludeArtifactId(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getArtifactArtifacts());
 
         mojo.includeArtifactIds = "one";
@@ -364,7 +383,7 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         Iterator<Artifact> iter = mojo.getProject().getArtifacts().iterator();
         while (iter.hasNext()) {
             Artifact artifact = iter.next();
-            assertUnpacked(false, artifact);
+            assertUnpacked(mojo, false, artifact);
         }
         mojo.excludeArtifactIds = "";
         mojo.execute();
@@ -372,11 +391,13 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         iter = mojo.getProject().getArtifacts().iterator();
         while (iter.hasNext()) {
             Artifact artifact = iter.next();
-            assertUnpacked(artifact.getArtifactId().equals("one"), artifact);
+            assertUnpacked(mojo, artifact.getArtifactId().equals("one"), artifact);
         }
     }
 
-    public void testExcludeArtifactId() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeArtifactId(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getArtifactArtifacts());
         mojo.excludeArtifactIds = "one";
         mojo.execute();
@@ -385,21 +406,25 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         // do not have a classifier of "one"
         // then delete the file and at the end, verify the folder is empty.
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(!artifact.getArtifactId().equals("one"), artifact);
+            assertUnpacked(mojo, !artifact.getArtifactId().equals("one"), artifact);
         }
     }
 
-    public void testExcludeGroupId() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testExcludeGroupId(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
         mojo.excludeGroupIds = "one";
         mojo.execute();
 
         for (Artifact artifact : mojo.getProject().getArtifacts()) {
-            assertUnpacked(!artifact.getGroupId().equals("one"), artifact);
+            assertUnpacked(mojo, !artifact.getGroupId().equals("one"), artifact);
         }
     }
 
-    public void testIncludeGroupId() throws Exception {
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testIncludeGroupId(UnpackDependenciesMojo mojo) throws Exception {
         mojo.getProject().setArtifacts(stubFactory.getGroupIdArtifacts());
         mojo.includeGroupIds = "one";
         mojo.excludeGroupIds = "one";
@@ -411,7 +436,7 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         while (iter.hasNext()) {
             Artifact artifact = iter.next();
             // Testing with artifact id because group id is not in filename
-            assertUnpacked(false, artifact);
+            assertUnpacked(mojo, false, artifact);
         }
 
         mojo.excludeGroupIds = "";
@@ -421,23 +446,30 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         while (iter.hasNext()) {
             Artifact artifact = iter.next();
             // Testing with artifact id because group id is not in filename
-            assertUnpacked(artifact.getGroupId().equals("one"), artifact);
+            assertUnpacked(mojo, artifact.getGroupId().equals("one"), artifact);
         }
     }
 
-    public void testCDMClassifier() throws Exception {
-        dotestClassifierType("jdk14", null);
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testCDMClassifier(UnpackDependenciesMojo mojo) throws Exception {
+        dotestClassifierType(mojo, "jdk14", null);
     }
 
-    public void testCDMType() throws Exception {
-        dotestClassifierType(null, "zip");
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testCDMType(UnpackDependenciesMojo mojo) throws Exception {
+        dotestClassifierType(mojo, null, "zip");
     }
 
-    public void testCDMClassifierType() throws Exception {
-        dotestClassifierType("jdk14", "war");
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testCDMClassifierType(UnpackDependenciesMojo mojo) throws Exception {
+        dotestClassifierType(mojo, "jdk14", "war");
     }
 
-    public void dotestClassifierType(String testClassifier, String testType) throws Exception {
+    private void dotestClassifierType(UnpackDependenciesMojo mojo, String testClassifier, String testType)
+            throws Exception {
         mojo.classifier = testClassifier;
         mojo.type = testType;
 
@@ -473,15 +505,17 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
                     Artifact.SCOPE_COMPILE,
                     useType,
                     useClassifier);
-            assertUnpacked(unpacked);
+            assertUnpacked(mojo, unpacked);
         }
     }
 
-    public void testArtifactResolutionException() throws MojoFailureException {
-        dotestArtifactExceptions();
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testArtifactResolutionException(UnpackDependenciesMojo mojo) throws MojoFailureException {
+        dotestArtifactExceptions(mojo);
     }
 
-    public void dotestArtifactExceptions() throws MojoFailureException {
+    private void dotestArtifactExceptions(UnpackDependenciesMojo mojo) throws MojoFailureException {
         mojo.classifier = "jdk";
         mojo.failOnMissingClassifierArtifact = true;
         mojo.type = "java-sources";
@@ -492,46 +526,4 @@ public class TestUnpackDependenciesMojo extends AbstractDependencyMojoTestCase {
         } catch (MojoExecutionException e) {
         }
     }
-
-    public File getUnpackedFile(Artifact artifact) {
-        File destDir = DependencyUtil.getFormattedOutputDirectory(
-                mojo.isUseSubDirectoryPerScope(),
-                mojo.isUseSubDirectoryPerType(),
-                mojo.isUseSubDirectoryPerArtifact(),
-                mojo.useRepositoryLayout,
-                mojo.stripVersion,
-                mojo.stripType,
-                mojo.getOutputDirectory(),
-                artifact);
-        File unpacked = new File(destDir, DependencyArtifactStubFactory.getUnpackableFileName(artifact));
-        assertTrue(unpacked.exists());
-        return unpacked;
-    }
-
-    public DefaultFileMarkerHandler getUnpackedMarkerHandler(Artifact artifact) {
-        return new DefaultFileMarkerHandler(artifact, mojo.getMarkersDirectory());
-    }
-
-    public void assertUnpacked(Artifact artifact, boolean overWrite)
-            throws InterruptedException, MojoExecutionException, MojoFailureException {
-        File unpackedFile = getUnpackedFile(artifact);
-
-        Thread.sleep(100);
-        // round down to the last second
-        long time = System.currentTimeMillis();
-        time = time - (time % 1000);
-        assertTrue(unpackedFile.setLastModified(time));
-        // wait at least a second for filesystems that only record to the
-        // nearest second.
-        Thread.sleep(1000);
-
-        assertEquals(time, unpackedFile.lastModified());
-        mojo.execute();
-
-        if (overWrite) {
-            assertTrue(time != unpackedFile.lastModified());
-        } else {
-            assertEquals(time, unpackedFile.lastModified());
-        }
-    }
 }
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java
index 932dbb56..0f61cd5a 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java
@@ -18,76 +18,74 @@
  */
 package org.apache.maven.plugins.dependency.fromDependencies;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoExtension;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
 import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase {
+@MojoTest
+@Basedir("/unit/unpack-dependencies-test")
+class TestUnpackDependenciesMojo2 {
 
-    private static final String UNPACKABLE_FILE = "test.txt";
+    @TempDir
+    private File tempDir;
 
-    private static final String UNPACKABLE_FILE_PATH =
-            "target/test-classes/unit/unpack-dependencies-test/" + UNPACKABLE_FILE;
+    private DependencyArtifactStubFactory stubFactory;
 
-    private UnpackDependenciesMojo mojo;
+    @Inject
+    private MavenSession session;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "unpack-dependencies";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
+    @Inject
+    private MavenProject project;
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+    @Inject
+    private ArchiverManager archiverManager;
 
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
-
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    private static final String UNPACKABLE_FILE = "test.txt";
 
-        File testPom = new File(getBasedir(), "target/test-classes/unit/unpack-dependencies-test/plugin-config.xml");
-        mojo = (UnpackDependenciesMojo) lookupMojo("unpack-dependencies", testPom);
-        mojo.outputDirectory = new File(this.testDir, "outputDirectory");
+    @BeforeEach
+    void setUp() throws Exception {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
 
         // it needs to get the archivermanager
-        stubFactory.setUnpackableFile(lookup(ArchiverManager.class));
+        stubFactory.setUnpackableFile(archiverManager);
         // i'm using one file repeatedly to archive so I can test the name
         // programmatically.
-        stubFactory.setSrcFile(new File(getBasedir() + File.separatorChar + UNPACKABLE_FILE_PATH));
-
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
+        stubFactory.setSrcFile(MojoExtension.getTestFile(UNPACKABLE_FILE));
 
         Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
         Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
         artifacts.addAll(directArtifacts);
 
         project.setArtifacts(artifacts);
-        mojo.markersDirectory = new File(this.testDir, "markers");
+
+        project.getBuild().setDirectory(new File(tempDir, "target").getAbsolutePath());
     }
 
-    public File getUnpackedFile(Artifact artifact) {
+    private File getUnpackedFile(UnpackDependenciesMojo mojo, Artifact artifact) {
         File destDir = DependencyUtil.getFormattedOutputDirectory(
                 mojo.isUseSubDirectoryPerScope(),
                 mojo.isUseSubDirectoryPerType(),
@@ -102,7 +100,9 @@ public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase
         return unpacked;
     }
 
-    public void testDontOverWriteRelease()
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testDontOverWriteRelease(UnpackDependenciesMojo mojo)
             throws MojoExecutionException, InterruptedException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
@@ -117,10 +117,12 @@ public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase
 
         mojo.execute();
 
-        assertUnpacked(release, false);
+        assertUnpacked(mojo, release, false);
     }
 
-    public void testOverWriteRelease()
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testOverWriteRelease(UnpackDependenciesMojo mojo)
             throws MojoExecutionException, InterruptedException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
@@ -136,10 +138,12 @@ public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase
 
         mojo.execute();
 
-        assertUnpacked(release, true);
+        assertUnpacked(mojo, release, true);
     }
 
-    public void testDontOverWriteSnap()
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testDontOverWriteSnap(UnpackDependenciesMojo mojo)
             throws MojoExecutionException, InterruptedException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
@@ -156,10 +160,12 @@ public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase
 
         mojo.execute();
 
-        assertUnpacked(snap, false);
+        assertUnpacked(mojo, snap, false);
     }
 
-    public void testOverWriteSnap()
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testOverWriteSnap(UnpackDependenciesMojo mojo)
             throws MojoExecutionException, InterruptedException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
@@ -176,10 +182,12 @@ public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase
 
         mojo.execute();
 
-        assertUnpacked(snap, true);
+        assertUnpacked(mojo, snap, true);
     }
 
-    public void testOverWriteIfNewer()
+    @Test
+    @InjectMojo(goal = "unpack-dependencies")
+    void testOverWriteIfNewer(UnpackDependenciesMojo mojo)
             throws MojoExecutionException, InterruptedException, IOException, MojoFailureException {
 
         Set<Artifact> artifacts = new HashSet<>();
@@ -196,7 +204,7 @@ public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase
 
         mojo.execute();
 
-        File unpackedFile = getUnpackedFile(snap);
+        File unpackedFile = getUnpackedFile(mojo, snap);
 
         // round down to the last second
         long time = System.currentTimeMillis();
@@ -221,9 +229,9 @@ public class TestUnpackDependenciesMojo2 extends AbstractDependencyMojoTestCase
         assertNotEquals(time, unpackedFile.lastModified());
     }
 
-    public void assertUnpacked(Artifact artifact, boolean overWrite)
+    private void assertUnpacked(UnpackDependenciesMojo mojo, Artifact artifact, boolean overWrite)
             throws InterruptedException, MojoExecutionException, MojoFailureException {
-        File unpackedFile = getUnpackedFile(artifact);
+        File unpackedFile = getUnpackedFile(mojo, artifact);
 
         Thread.sleep(100);
         // round down to the last second
diff --git a/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java b/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java
index 2af96776..3e705ec6 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java
@@ -24,43 +24,42 @@ import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class ResolveDependenciesMojoTest extends AbstractDependencyMojoTestCase {
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "dss";
-    }
+class ResolveDependenciesMojoTest {
 
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
+    private DependencyArtifactStubFactory stubFactory;
 
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+    @BeforeEach
+    void setUp() {
+        stubFactory = new DependencyArtifactStubFactory(null, false, false);
     }
 
-    public void testDependencyStatusLog() throws IOException {
+    @Test
+    void testDependencyStatusLog() throws IOException {
         Set<Artifact> artifacts = this.stubFactory.getMixedArtifacts();
         doTestDependencyStatusLog(artifacts);
     }
 
-    public void testDependencyStatusLogNullFiles() throws IOException {
+    @Test
+    void testDependencyStatusLogNullFiles() throws IOException {
         this.stubFactory.setCreateFiles(false);
         Set<Artifact> artifacts = this.stubFactory.getMixedArtifacts();
         doTestDependencyStatusLog(artifacts);
     }
 
-    public void testDependencyStatusEmptySet() {
+    @Test
+    void testDependencyStatusEmptySet() {
         doTestDependencyStatusLog(new HashSet<>());
     }
 
-    public void testOptionalDependencyFormatting() throws IOException {
+    @Test
+    void testOptionalDependencyFormatting() throws IOException {
         Set<Artifact> set = new HashSet<>();
         Artifact artifact =
                 stubFactory.createArtifact("g", "a", VersionRange.createFromVersion("1.0"), "test", "jar", null, true);
diff --git a/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
index 2a5d2d84..7f4e5be2 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
@@ -18,56 +18,41 @@
  */
 package org.apache.maven.plugins.dependency.resolvers;
 
-import java.io.File;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
 import org.apache.maven.plugins.dependency.utils.DependencySilentLog;
 import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
 import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.Test;
 
-public class TestResolveMojo extends AbstractDependencyMojoTestCase {
+import static org.apache.maven.api.plugin.testing.MojoExtension.setVariableValueToObject;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.AssertionsKt.assertNotNull;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "markers";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return false;
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
-
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
-
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
-    }
+@MojoTest
+class TestResolveMojo {
 
     /**
      * tests the proper discovery and configuration of the mojo
      *
      * @throws Exception in case of errors.
      */
-    public void testResolveTestEnvironment() throws Exception {
-        File testPom = new File(getBasedir(), "target/test-classes/unit/resolve-test/plugin-config.xml");
-        ResolveDependenciesMojo mojo = (ResolveDependenciesMojo) lookupMojo("resolve", testPom);
-
+    @Test
+    @InjectMojo(goal = "resolve")
+    void testResolveTestEnvironment(ResolveDependenciesMojo mojo) throws Exception {
         assertNotNull(mojo);
         assertNotNull(mojo.getProject());
         MavenProject project = mojo.getProject();
 
-        Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
-        Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
+        DependencyArtifactStubFactory stubFactory = new DependencyArtifactStubFactory(null, false);
+        Set<Artifact> artifacts = stubFactory.getScopedArtifacts();
+        Set<Artifact> directArtifacts = stubFactory.getReleaseAndSnapshotArtifacts();
         artifacts.addAll(directArtifacts);
 
         project.setArtifacts(artifacts);
@@ -86,10 +71,9 @@ public class TestResolveMojo extends AbstractDependencyMojoTestCase {
         assertEquals(directArtifacts.size(), results.getResolvedDependencies().size());
     }
 
-    public void testSilent() throws Exception {
-        File testPom = new File(getBasedir(), "target/test-classes/unit/resolve-test/plugin-config.xml");
-        ResolveDependenciesMojo mojo = (ResolveDependenciesMojo) lookupMojo("resolve", testPom);
-
+    @Test
+    @InjectMojo(goal = "resolve")
+    void testSilent(ResolveDependenciesMojo mojo) {
         assertFalse(mojo.getLog() instanceof DependencySilentLog);
 
         mojo.setSilent(true);
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DependencyProjectStub.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DependencyProjectStub.java
deleted file mode 100644
index 9edcfb35..00000000
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DependencyProjectStub.java
+++ /dev/null
@@ -1,881 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.dependency.testUtils.stubs;
-
-import java.io.File;
-import java.io.Writer;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.model.Build;
-import org.apache.maven.model.CiManagement;
-import org.apache.maven.model.Contributor;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.Developer;
-import org.apache.maven.model.DistributionManagement;
-import org.apache.maven.model.Extension;
-import org.apache.maven.model.IssueManagement;
-import org.apache.maven.model.License;
-import org.apache.maven.model.MailingList;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Organization;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginManagement;
-import org.apache.maven.model.Prerequisites;
-import org.apache.maven.model.Profile;
-import org.apache.maven.model.ReportPlugin;
-import org.apache.maven.model.Reporting;
-import org.apache.maven.model.Repository;
-import org.apache.maven.model.Resource;
-import org.apache.maven.model.Scm;
-import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.eclipse.aether.repository.RemoteRepository;
-
-/**
- * very simple stub of maven project, going to take a lot of work to make it useful as a stub though
- */
-public class DependencyProjectStub extends MavenProject {
-    private String groupId;
-
-    private String artifactId;
-
-    private String name;
-
-    private Model model;
-
-    private MavenProject parent;
-
-    private List<Dependency> dependencies;
-
-    private File file;
-
-    private List<MavenProject> collectedProjects;
-
-    private List<Artifact> attachedArtifacts;
-
-    private List<String> compileSourceRoots;
-
-    private List<String> testCompileSourceRoots;
-
-    private List<String> scriptSourceRoots;
-
-    private List<ArtifactRepository> pluginArtifactRepositories;
-
-    private List<Profile> activeProfiles;
-
-    private Set<Artifact> dependencyArtifacts;
-
-    private DependencyManagement dependencyManagement;
-
-    private Artifact artifact;
-
-    private Model originalModel;
-
-    private boolean executionRoot;
-
-    private List<Artifact> compileArtifacts;
-
-    private List<Dependency> compileDependencies;
-
-    private List<Dependency> systemDependencies;
-
-    private List<String> testClasspathElements;
-
-    private List<Dependency> testDependencies;
-
-    private List<String> systemClasspathElements;
-
-    private List<Artifact> systemArtifacts;
-
-    private List<Artifact> testArtifacts;
-
-    private List<Artifact> runtimeArtifacts;
-
-    private List<Dependency> runtimeDependencies;
-
-    private List<String> runtimeClasspathElements;
-
-    private String modelVersion;
-
-    private String packaging;
-
-    private String inceptionYear;
-
-    private String url;
-
-    private String description;
-
-    private String version;
-
-    private String defaultGoal;
-
-    private Set<Artifact> artifacts;
-
-    private Properties properties;
-
-    public DependencyProjectStub() {
-        super((Model) null);
-    }
-
-    // kinda dangerous...
-    public DependencyProjectStub(Model model) {
-        // super(model);
-        super((Model) null);
-    }
-
-    // kinda dangerous...
-    public DependencyProjectStub(MavenProject project) {
-        // super(project);
-        super((Model) null);
-    }
-
-    @Override
-    @Deprecated
-    public String getModulePathAdjustment(MavenProject mavenProject) {
-        return "";
-    }
-
-    @Override
-    public Artifact getArtifact() {
-        if (artifact == null) {
-            ArtifactHandler ah = new DefaultArtifactHandlerStub("jar", null);
-
-            VersionRange vr = VersionRange.createFromVersion("1.0");
-            Artifact art = new DefaultArtifact("group", "artifact", vr, Artifact.SCOPE_COMPILE, "jar", null, ah, false);
-            setArtifact(art);
-        }
-        return artifact;
-    }
-
-    @Override
-    public void setArtifact(Artifact artifact) {
-        this.artifact = artifact;
-    }
-
-    @Override
-    public Model getModel() {
-        return model;
-    }
-
-    @Override
-    public MavenProject getParent() {
-        return parent;
-    }
-
-    @Override
-    public void setParent(MavenProject mavenProject) {
-        this.parent = mavenProject;
-    }
-
-    @Override
-    public void setRemoteArtifactRepositories(List<ArtifactRepository> list) {}
-
-    @Override
-    public List<ArtifactRepository> getRemoteArtifactRepositories() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<RemoteRepository> getRemoteProjectRepositories() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public boolean hasParent() {
-        return (parent != null);
-    }
-
-    @Override
-    public File getFile() {
-        return file;
-    }
-
-    @Override
-    public void setFile(File file) {
-        this.file = file;
-    }
-
-    @Override
-    public File getBasedir() {
-        return new File(PlexusTestCase.getBasedir());
-    }
-
-    @Override
-    public void setDependencies(List<Dependency> list) {
-        dependencies = list;
-    }
-
-    @Override
-    public List<Dependency> getDependencies() {
-        if (dependencies == null) {
-            dependencies = Collections.emptyList();
-        }
-        return dependencies;
-    }
-
-    public void setDependencyManagement(DependencyManagement depMgt) {
-        this.dependencyManagement = depMgt;
-    }
-
-    @Override
-    public DependencyManagement getDependencyManagement() {
-        if (dependencyManagement == null) {
-            dependencyManagement = new DependencyManagement();
-        }
-
-        return dependencyManagement;
-    }
-
-    @Override
-    public void addCompileSourceRoot(String string) {
-        if (compileSourceRoots == null) {
-            compileSourceRoots = Collections.singletonList(string);
-        } else {
-            compileSourceRoots.add(string);
-        }
-    }
-
-    @Override
-    @Deprecated
-    public void addScriptSourceRoot(String string) {
-        if (scriptSourceRoots == null) {
-            scriptSourceRoots = Collections.singletonList(string);
-        } else {
-            scriptSourceRoots.add(string);
-        }
-    }
-
-    @Override
-    public void addTestCompileSourceRoot(String string) {
-        if (testCompileSourceRoots == null) {
-            testCompileSourceRoots = Collections.singletonList(string);
-        } else {
-            testCompileSourceRoots.add(string);
-        }
-    }
-
-    @Override
-    public List<String> getCompileSourceRoots() {
-        return compileSourceRoots;
-    }
-
-    @Override
-    @Deprecated
-    public List<String> getScriptSourceRoots() {
-        return scriptSourceRoots;
-    }
-
-    @Override
-    public List<String> getTestCompileSourceRoots() {
-        return testCompileSourceRoots;
-    }
-
-    @Override
-    public List<String> getCompileClasspathElements() {
-        return compileSourceRoots;
-    }
-
-    @Override
-    @Deprecated
-    public List<Artifact> getCompileArtifacts() {
-        return compileArtifacts;
-    }
-
-    @Override
-    @Deprecated
-    public List<Dependency> getCompileDependencies() {
-        return compileDependencies;
-    }
-
-    @Override
-    public List<String> getTestClasspathElements() {
-        return testClasspathElements;
-    }
-
-    @Override
-    @Deprecated
-    public List<Artifact> getTestArtifacts() {
-        return testArtifacts;
-    }
-
-    @Override
-    @Deprecated
-    public List<Dependency> getTestDependencies() {
-        return testDependencies;
-    }
-
-    @Override
-    public List<String> getRuntimeClasspathElements() {
-        return runtimeClasspathElements;
-    }
-
-    @Override
-    @Deprecated
-    public List<Artifact> getRuntimeArtifacts() {
-        return runtimeArtifacts;
-    }
-
-    @Override
-    @Deprecated
-    public List<Dependency> getRuntimeDependencies() {
-        return runtimeDependencies;
-    }
-
-    @Override
-    @Deprecated
-    public List<String> getSystemClasspathElements() {
-        return systemClasspathElements;
-    }
-
-    @Override
-    @Deprecated
-    public List<Artifact> getSystemArtifacts() {
-        return systemArtifacts;
-    }
-
-    @Override
-    public void setAttachedArtifacts(List<Artifact> attachedArtifacts) {
-        this.attachedArtifacts = attachedArtifacts;
-    }
-
-    @Override
-    public void setCompileSourceRoots(List<String> compileSourceRoots) {
-        this.compileSourceRoots = compileSourceRoots;
-    }
-
-    @Override
-    public void setTestCompileSourceRoots(List<String> testCompileSourceRoots) {
-        this.testCompileSourceRoots = testCompileSourceRoots;
-    }
-
-    @Override
-    @Deprecated
-    public void setScriptSourceRoots(List<String> scriptSourceRoots) {
-        this.scriptSourceRoots = scriptSourceRoots;
-    }
-
-    @Override
-    public void setModel(Model model) {
-        this.model = model;
-    }
-
-    @Override
-    @Deprecated
-    public List<Dependency> getSystemDependencies() {
-        return systemDependencies;
-    }
-
-    @Override
-    public void setModelVersion(String string) {
-        this.modelVersion = string;
-    }
-
-    @Override
-    public String getModelVersion() {
-        return modelVersion;
-    }
-
-    @Override
-    public String getId() {
-        return "";
-    }
-
-    @Override
-    public void setGroupId(String string) {
-        this.groupId = string;
-    }
-
-    @Override
-    public String getGroupId() {
-        return groupId;
-    }
-
-    @Override
-    public void setArtifactId(String string) {
-        this.artifactId = string;
-    }
-
-    @Override
-    public String getArtifactId() {
-        return artifactId;
-    }
-
-    @Override
-    public void setName(String string) {
-        this.name = string;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public void setVersion(String string) {
-        this.version = string;
-    }
-
-    @Override
-    public String getVersion() {
-        return version;
-    }
-
-    @Override
-    public String getPackaging() {
-        return packaging;
-    }
-
-    @Override
-    public void setPackaging(String string) {
-        this.packaging = string;
-    }
-
-    @Override
-    public void setInceptionYear(String string) {
-        this.inceptionYear = string;
-    }
-
-    @Override
-    public String getInceptionYear() {
-        return inceptionYear;
-    }
-
-    @Override
-    public void setUrl(String string) {
-        this.url = string;
-    }
-
-    @Override
-    public String getUrl() {
-        return url;
-    }
-
-    @Override
-    public Prerequisites getPrerequisites() {
-        return null;
-    }
-
-    @Override
-    public void setIssueManagement(IssueManagement issueManagement) {}
-
-    @Override
-    public CiManagement getCiManagement() {
-        return null;
-    }
-
-    @Override
-    public void setCiManagement(CiManagement ciManagement) {}
-
-    @Override
-    public IssueManagement getIssueManagement() {
-        return null;
-    }
-
-    @Override
-    public void setDistributionManagement(DistributionManagement distributionManagement) {}
-
-    @Override
-    public DistributionManagement getDistributionManagement() {
-        return null;
-    }
-
-    @Override
-    public void setDescription(String string) {
-        this.description = string;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public void setOrganization(Organization organization) {}
-
-    @Override
-    public Organization getOrganization() {
-        return null;
-    }
-
-    @Override
-    public void setScm(Scm scm) {}
-
-    @Override
-    public Scm getScm() {
-        return null;
-    }
-
-    @Override
-    public void setMailingLists(List<MailingList> list) {}
-
-    @Override
-    public List<MailingList> getMailingLists() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void addMailingList(MailingList mailingList) {}
-
-    @Override
-    public void setDevelopers(List<Developer> list) {}
-
-    @Override
-    public List<Developer> getDevelopers() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void addDeveloper(Developer developer) {}
-
-    @Override
-    public void setContributors(List<Contributor> list) {}
-
-    @Override
-    public List<Contributor> getContributors() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void addContributor(Contributor contributor) {}
-
-    @Override
-    public void setBuild(Build build) {}
-
-    @Override
-    public Build getBuild() {
-        return null;
-    }
-
-    @Override
-    public List<Resource> getResources() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<Resource> getTestResources() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void addResource(Resource resource) {}
-
-    @Override
-    public void addTestResource(Resource resource) {}
-
-    @Override
-    @Deprecated
-    public void setReporting(Reporting reporting) {}
-
-    @Override
-    @Deprecated
-    public Reporting getReporting() {
-        return null;
-    }
-
-    @Override
-    public void setLicenses(List<License> list) {}
-
-    @Override
-    public List<License> getLicenses() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void addLicense(License license) {}
-
-    @Override
-    public void setArtifacts(Set<Artifact> set) {
-        this.artifacts = set;
-    }
-
-    @Override
-    public Set<Artifact> getArtifacts() {
-        if (artifacts == null) {
-            return Collections.emptySet();
-        } else {
-            return artifacts;
-        }
-    }
-
-    @Override
-    public Map<String, Artifact> getArtifactMap() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public void setPluginArtifacts(Set<Artifact> set) {}
-
-    @Override
-    public Set<Artifact> getPluginArtifacts() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public Map<String, Artifact> getPluginArtifactMap() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    @Deprecated
-    public void setReportArtifacts(Set<Artifact> set) {}
-
-    @Override
-    @Deprecated
-    public Set<Artifact> getReportArtifacts() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public Map<String, Artifact> getReportArtifactMap() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    @Deprecated
-    public void setExtensionArtifacts(Set<Artifact> set) {}
-
-    @Override
-    @Deprecated
-    public Set<Artifact> getExtensionArtifacts() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    @Deprecated
-    public Map<String, Artifact> getExtensionArtifactMap() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public void setParentArtifact(Artifact artifact) {}
-
-    @Override
-    public Artifact getParentArtifact() {
-        return null;
-    }
-
-    @Override
-    public List<Repository> getRepositories() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    @Deprecated
-    public List<ReportPlugin> getReportPlugins() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<Plugin> getBuildPlugins() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<String> getModules() {
-        return Collections.singletonList("");
-    }
-
-    @Override
-    public PluginManagement getPluginManagement() {
-        return null;
-    }
-
-    @Override
-    public List<MavenProject> getCollectedProjects() {
-        return collectedProjects;
-    }
-
-    @Override
-    public void setCollectedProjects(List<MavenProject> list) {
-        this.collectedProjects = list;
-    }
-
-    @Override
-    public void setPluginArtifactRepositories(List<ArtifactRepository> list) {
-        this.pluginArtifactRepositories = list;
-    }
-
-    @Override
-    public List<ArtifactRepository> getPluginArtifactRepositories() {
-        return pluginArtifactRepositories;
-    }
-
-    @Override
-    public ArtifactRepository getDistributionManagementArtifactRepository() {
-        return null;
-    }
-
-    @Override
-    public List<Repository> getPluginRepositories() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void setActiveProfiles(List<Profile> list) {
-        activeProfiles = list;
-    }
-
-    @Override
-    public List<Profile> getActiveProfiles() {
-        return activeProfiles;
-    }
-
-    @Override
-    public void addAttachedArtifact(Artifact theArtifact) {
-        if (attachedArtifacts == null) {
-            this.attachedArtifacts = Collections.singletonList(theArtifact);
-        } else {
-            attachedArtifacts.add(theArtifact);
-        }
-    }
-
-    @Override
-    public List<Artifact> getAttachedArtifacts() {
-        return attachedArtifacts;
-    }
-
-    @Override
-    public Xpp3Dom getGoalConfiguration(String string, String string1, String string2, String string3) {
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    public Xpp3Dom getReportConfiguration(String string, String string1, String string2) {
-        return null;
-    }
-
-    @Override
-    public MavenProject getExecutionProject() {
-        return null;
-    }
-
-    @Override
-    public void setExecutionProject(MavenProject mavenProject) {}
-
-    @Override
-    @Deprecated
-    public void writeModel(Writer writer) {}
-
-    @Override
-    @Deprecated
-    public void writeOriginalModel(Writer writer) {}
-
-    @Override
-    public Set<Artifact> getDependencyArtifacts() {
-        return dependencyArtifacts;
-    }
-
-    @Override
-    public void setDependencyArtifacts(Set<Artifact> set) {
-        this.dependencyArtifacts = set;
-    }
-
-    @Override
-    public void setReleaseArtifactRepository(ArtifactRepository artifactRepository) {
-        // this.releaseArtifactRepository = artifactRepository;
-    }
-
-    @Override
-    public void setSnapshotArtifactRepository(ArtifactRepository artifactRepository) {
-        // this.snapshotArtifactRepository = artifactRepository;
-    }
-
-    @Override
-    public void setOriginalModel(Model model) {
-        this.originalModel = model;
-    }
-
-    @Override
-    public Model getOriginalModel() {
-        return originalModel;
-    }
-
-    @Override
-    public List<Extension> getBuildExtensions() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    @Deprecated
-    public Set<Artifact> createArtifacts(
-            ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter) {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public void addProjectReference(MavenProject mavenProject) {}
-
-    @Override
-    @Deprecated
-    public void attachArtifact(String string, String string1, File theFile) {}
-
-    @Override
-    public Properties getProperties() {
-        if (properties == null) {
-            properties = new Properties();
-        }
-        return properties;
-    }
-
-    @Override
-    public List<String> getFilters() {
-        return Collections.singletonList("");
-    }
-
-    @Override
-    public Map<String, MavenProject> getProjectReferences() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public boolean isExecutionRoot() {
-        return executionRoot;
-    }
-
-    @Override
-    public void setExecutionRoot(boolean b) {
-        this.executionRoot = b;
-    }
-
-    @Override
-    public String getDefaultGoal() {
-        return defaultGoal;
-    }
-
-    @Override
-    @Deprecated
-    public Artifact replaceWithActiveArtifact(Artifact theArtifact) {
-        return null;
-    }
-}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubMarkerFile.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubMarkerFile.java
index 82952245..5423b087 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubMarkerFile.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubMarkerFile.java
@@ -20,28 +20,16 @@ package org.apache.maven.plugins.dependency.testUtils.stubs;
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URI;
 
 public class StubMarkerFile extends File {
 
     private static final long serialVersionUID = 1L;
 
-    public StubMarkerFile(String pathname) {
-        super(pathname);
-    }
-
-    public StubMarkerFile(URI uri) {
-        super(uri);
-    }
-
     public StubMarkerFile(File parent, String child) {
         super(parent, child);
     }
 
-    public StubMarkerFile(String parent, String child) {
-        super(parent, child);
-    }
-
+    @Override
     public boolean createNewFile() throws IOException {
         throw new IOException("Intended Error");
     }
diff --git a/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java b/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java
index b34fa55b..1931fc98 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java
@@ -18,8 +18,9 @@
  */
 package org.apache.maven.plugins.dependency.tree;
 
+import javax.inject.Inject;
+
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.StringReader;
@@ -37,14 +38,27 @@ import jakarta.json.Json;
 import jakarta.json.JsonArray;
 import jakarta.json.JsonObject;
 import jakarta.json.JsonReader;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.LegacySupport;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
+import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.dependency.graph.DependencyNode;
 import org.apache.maven.shared.dependency.graph.internal.DefaultDependencyNode;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.apache.maven.api.plugin.testing.MojoExtension.setVariableValueToObject;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
 
 /**
  * Tests <code>TreeMojo</code>.
@@ -53,36 +67,25 @@ import org.apache.maven.shared.dependency.graph.internal.DefaultDependencyNode;
  * @version $Id$
  * @since 2.0
  */
-public class TestTreeMojo extends AbstractDependencyMojoTestCase {
-    // TestCase methods -------------------------------------------------------
+@MojoTest(realRepositorySession = true)
+class TestTreeMojo {
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "tree";
-    }
+    @TempDir
+    private File tempDir;
 
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
-    }
+    @Inject
+    private MavenSession session;
 
-    /*
-     * @see org.apache.maven.plugin.testing.AbstractMojoTestCase#setUp()
-     */
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
-
-        MavenProject project = new MavenProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+    private DependencyArtifactStubFactory stubFactory;
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    @BeforeEach
+    void setUp() {
+        stubFactory = new DependencyArtifactStubFactory(tempDir, true, false);
+        session.getRequest().setLocalRepositoryPath(new File(tempDir, "localTestRepo"));
 
-        LegacySupport legacySupport = lookup(LegacySupport.class);
-        legacySupport.setSession(session);
-        installLocalRepository(legacySupport);
+        DefaultProjectBuildingRequest pbr = spy(new DefaultProjectBuildingRequest());
+        doAnswer(__ -> session.getRepositorySession()).when(pbr).getRepositorySession();
+        when(session.getProjectBuildingRequest()).thenReturn(pbr);
     }
 
     // tests ------------------------------------------------------------------
@@ -92,10 +95,9 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of an error.
      */
-    public void testTreeTestEnvironment() throws Exception {
-        File testPom = new File(getBasedir(), "target/test-classes/unit/tree-test/plugin-config.xml");
-        TreeMojo mojo = (TreeMojo) lookupMojo("tree", testPom);
-
+    @Test
+    @InjectMojo(goal = "tree")
+    void testTreeTestEnvironment(TreeMojo mojo) throws Exception {
         assertNotNull(mojo);
         assertNotNull(mojo.getProject());
         MavenProject project = mojo.getProject();
@@ -128,8 +130,11 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of an error.
      */
-    public void testTreeDotSerializing() throws Exception {
-        List<String> contents = runTreeMojo("tree1.dot", "dot");
+    @Test
+    @InjectMojo(goal = "tree")
+    @MojoParameter(name = "outputType", value = "dot")
+    void testTreeDotSerializing(TreeMojo mojo) throws Exception {
+        List<String> contents = runTreeMojo(mojo);
         assertTrue(findString(contents, "digraph \"testGroupId:project:jar:1.0:compile\" {"));
         assertTrue(findString(
                 contents,
@@ -143,8 +148,11 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of an error.
      */
-    public void testTreeGraphMLSerializing() throws Exception {
-        List<String> contents = runTreeMojo("tree1.graphml", "graphml");
+    @Test
+    @InjectMojo(goal = "tree")
+    @MojoParameter(name = "outputType", value = "graphml")
+    void testTreeGraphMLSerializing(TreeMojo mojo) throws Exception {
+        List<String> contents = runTreeMojo(mojo);
 
         assertTrue(findString(contents, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
         assertTrue(findString(contents, "<y:NodeLabel>testGroupId:project:jar:1.0:compile</y:NodeLabel>"));
@@ -159,8 +167,11 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
      *
      * @throws Exception in case of an error.
      */
-    public void testTreeTGFSerializing() throws Exception {
-        List<String> contents = runTreeMojo("tree1.tgf", "tgf");
+    @Test
+    @InjectMojo(goal = "tree")
+    @MojoParameter(name = "outputType", value = "tgf")
+    void testTreeTGFSerializing(TreeMojo mojo) throws Exception {
+        List<String> contents = runTreeMojo(mojo);
         assertTrue(findString(contents, "testGroupId:project:jar:1.0:compile"));
         assertTrue(findString(contents, "testGroupId:snapshot:jar:2.0-SNAPSHOT:compile"));
         assertTrue(findString(contents, "testGroupId:release:jar:1.0:compile"));
@@ -169,9 +180,9 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
     /**
      * Test the JSON format serialization on DependencyNodes with circular dependence
      */
-    public void testTreeJsonCircularDependency() throws IOException {
-        String outputFileName = testDir.getAbsolutePath() + File.separator + "tree1.json";
-        File outputFile = new File(outputFileName);
+    @Test
+    void testTreeJsonCircularDependency() throws IOException {
+        File outputFile = new File(tempDir, "tree1.json");
         Files.createDirectories(outputFile.getParentFile().toPath());
         outputFile.createNewFile();
 
@@ -180,13 +191,14 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
         DefaultDependencyNode node1 = new DefaultDependencyNode(artifact1);
         DefaultDependencyNode node2 = new DefaultDependencyNode(artifact2);
 
-        node1.setChildren(new ArrayList<DependencyNode>());
-        node2.setChildren(new ArrayList<DependencyNode>());
+        node1.setChildren(new ArrayList<>());
+        node2.setChildren(new ArrayList<>());
 
         node1.getChildren().add(node2);
         node2.getChildren().add(node1);
 
-        try (OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(outputFile))) {
+        try (OutputStreamWriter outputStreamWriter =
+                new OutputStreamWriter(Files.newOutputStream(outputFile.toPath()))) {
             JsonDependencyNodeVisitor jsonDependencyNodeVisitor = new JsonDependencyNodeVisitor(outputStreamWriter);
 
             jsonDependencyNodeVisitor.visit(node1);
@@ -196,23 +208,26 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
     /*
      * Test parsing of Json output and verify all key-value pairs
      */
-    public void testTreeJsonParsing() throws Exception {
-        List<String> contents = runTreeMojo("tree2.json", "json");
+    @Test
+    @InjectMojo(goal = "tree")
+    @MojoParameter(name = "outputType", value = "json")
+    void testTreeJsonParsing(TreeMojo mojo) throws Exception {
+        List<String> contents = runTreeMojo(mojo);
 
         System.setProperty("jakarta.json.provider", "org.glassfish.json.JsonProviderImpl");
         try (JsonReader reader = Json.createReader(new StringReader(String.join(System.lineSeparator(), contents)))) {
             JsonObject root = reader.readObject();
 
-            assertEquals(root.getString("groupId"), "testGroupId");
-            assertEquals(root.getString("artifactId"), "project");
-            assertEquals(root.getString("version"), "1.0");
-            assertEquals(root.getString("type"), "jar");
-            assertEquals(root.getString("scope"), "compile");
-            assertEquals(root.getString("classifier"), "");
-            assertEquals(root.getString("optional"), "false");
+            assertEquals("testGroupId", root.getString("groupId"));
+            assertEquals("project", root.getString("artifactId"));
+            assertEquals("1.0", root.getString("version"));
+            assertEquals("jar", root.getString("type"));
+            assertEquals("compile", root.getString("scope"));
+            assertEquals("", root.getString("classifier"));
+            assertEquals("false", root.getString("optional"));
 
             JsonArray children = root.getJsonArray("children");
-            assertEquals(children.size(), 2);
+            assertEquals(2, children.size());
 
             List<JsonObject> sortedChildren = children.stream()
                     .map(JsonObject.class::cast)
@@ -221,39 +236,34 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
 
             // Now that children are sorted, we can assert their values in a fixed order
             JsonObject child0 = sortedChildren.get(0);
-            assertEquals(child0.getString("groupId"), "testGroupId");
-            assertEquals(child0.getString("artifactId"), "release");
-            assertEquals(child0.getString("version"), "1.0");
-            assertEquals(child0.getString("type"), "jar");
-            assertEquals(child0.getString("scope"), "compile");
-            assertEquals(child0.getString("classifier"), "");
-            assertEquals(child0.getString("optional"), "false");
+            assertEquals("testGroupId", child0.getString("groupId"));
+            assertEquals("release", child0.getString("artifactId"));
+            assertEquals("1.0", child0.getString("version"));
+            assertEquals("jar", child0.getString("type"));
+            assertEquals("compile", child0.getString("scope"));
+            assertEquals("", child0.getString("classifier"));
+            assertEquals("false", child0.getString("optional"));
 
             JsonObject child1 = sortedChildren.get(1);
-            assertEquals(child1.getString("groupId"), "testGroupId");
-            assertEquals(child1.getString("artifactId"), "snapshot");
-            assertEquals(child1.getString("version"), "2.0-SNAPSHOT");
-            assertEquals(child1.getString("type"), "jar");
-            assertEquals(child1.getString("scope"), "compile");
-            assertEquals(child1.getString("classifier"), "");
-            assertEquals(child1.getString("optional"), "false");
+            assertEquals("testGroupId", child1.getString("groupId"));
+            assertEquals("snapshot", child1.getString("artifactId"));
+            assertEquals("2.0-SNAPSHOT", child1.getString("version"));
+            assertEquals("jar", child1.getString("type"));
+            assertEquals("compile", child1.getString("scope"));
+            assertEquals("", child1.getString("classifier"));
+            assertEquals("false", child1.getString("optional"));
         }
     }
 
     /**
      * Help finding content in the given list of string
      *
-     * @param outputFile the outputFile.
-     * @param format The format.
      * @throws Exception in case of an error.
      * @return list of strings in the output file
      */
-    private List<String> runTreeMojo(String outputFile, String format) throws Exception {
-        File testPom = new File(getBasedir(), "target/test-classes/unit/tree-test/plugin-config.xml");
-        Path outputFilePath = Paths.get(testDir.getAbsolutePath(), outputFile);
-        TreeMojo mojo = (TreeMojo) lookupMojo("tree", testPom);
+    private List<String> runTreeMojo(TreeMojo mojo) throws Exception {
+        Path outputFilePath = Paths.get(tempDir.getPath(), "outputFile.txt");
         setVariableValueToObject(mojo, "outputEncoding", "UTF-8");
-        setVariableValueToObject(mojo, "outputType", format);
         setVariableValueToObject(mojo, "outputFile", outputFilePath.toFile());
 
         assertNotNull(mojo);
@@ -270,9 +280,7 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
 
         mojo.execute();
 
-        List<String> contents = Files.readAllLines(outputFilePath);
-
-        return contents;
+        return Files.readAllLines(outputFilePath);
     }
 
     /**
@@ -310,11 +318,11 @@ public class TestTreeMojo extends AbstractDependencyMojoTestCase {
             DependencyNode actualNode) {
         Artifact actualArtifact = actualNode.getArtifact();
 
-        assertEquals("group id", expectedGroupId, actualArtifact.getGroupId());
-        assertEquals("artifact id", expectedArtifactId, actualArtifact.getArtifactId());
-        assertEquals("type", expectedType, actualArtifact.getType());
-        assertEquals("version", expectedVersion, actualArtifact.getVersion());
-        assertEquals("scope", expectedScope, actualArtifact.getScope());
+        assertEquals(expectedGroupId, actualArtifact.getGroupId(), "group id");
+        assertEquals(expectedArtifactId, actualArtifact.getArtifactId(), "artifact id");
+        assertEquals(expectedType, actualArtifact.getType(), "type");
+        assertEquals(expectedVersion, actualArtifact.getVersion(), "version");
+        assertEquals(expectedScope, actualArtifact.getScope(), "scope");
     }
 
     private String createArtifactCoordinateString(DependencyNode actualNode) {
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
index 719239bc..569cb6a7 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
@@ -53,7 +53,7 @@ class TestDependencyUtil {
     Artifact sources;
 
     @BeforeEach
-    protected void setUp() {
+    void setUp() {
 
         ArtifactHandler ah = new DefaultArtifactHandlerStub("jar", null);
         VersionRange vr = VersionRange.createFromVersion("1.1");
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java
index aa25db6e..e721bbdc 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java
@@ -20,8 +20,6 @@ package org.apache.maven.plugins.dependency.utils.filters;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
@@ -38,25 +36,23 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * @author brianf
  */
-public class TestDestFileFilter {
-    Set<Artifact> artifacts = new HashSet<>();
+class TestDestFileFilter {
 
     @TempDir
-    File outputFolder;
+    private File outputFolder;
 
-    DependencyArtifactStubFactory fact;
+    private DependencyArtifactStubFactory fact;
 
     @BeforeEach
-    protected void setUp() throws Exception {
+    void setUp() throws Exception {
         this.fact = new DependencyArtifactStubFactory(outputFolder, false);
-        artifacts = fact.getReleaseAndSnapshotArtifacts();
     }
 
-    public void createFile(Artifact artifact) throws IOException {
+    private void createFile(Artifact artifact) throws IOException {
         createFile(artifact, false, false, false);
     }
 
-    public File createFile(
+    private File createFile(
             Artifact artifact,
             boolean useSubDirectoryPerArtifact,
             boolean useSubDirectoryPerType,
@@ -65,7 +61,7 @@ public class TestDestFileFilter {
         return createFile(artifact, useSubDirectoryPerArtifact, useSubDirectoryPerType, removeVersion, false);
     }
 
-    public File createFile(
+    private File createFile(
             Artifact artifact,
             boolean useSubDirectoryPerArtifact,
             boolean useSubDirectoryPerType,
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java
index 75fba3f7..d89296c6 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java
@@ -45,7 +45,7 @@ class TestMarkerFileFilter {
     DependencyArtifactStubFactory fact;
 
     @BeforeEach
-    protected void setUp() throws Exception {
+    void setUp() throws Exception {
         this.fact = new DependencyArtifactStubFactory(outputFolder, false);
         artifacts = fact.getReleaseAndSnapshotArtifacts();
     }
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java
index df5da1c2..d007cfe8 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java
@@ -42,7 +42,7 @@ class TestResolveMarkerFileFilter {
     DependencyArtifactStubFactory fact;
 
     @BeforeEach
-    protected void setUp() throws IOException {
+    void setUp() throws IOException {
         fact = new DependencyArtifactStubFactory(outputFolder, false);
         fact.getReleaseAndSnapshotArtifacts();
     }
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java
index d13b89a8..52b8cd37 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java
@@ -49,7 +49,7 @@ class TestDefaultMarkerFileHandler {
     File outputFolder;
 
     @BeforeEach
-    protected void setUp() throws Exception {
+    void setUp() {
         ArtifactHandler ah = new DefaultArtifactHandler();
         VersionRange vr = VersionRange.createFromVersion("1.1");
         Artifact artifact = new DefaultArtifact("test", "1", vr, Artifact.SCOPE_COMPILE, "jar", "", ah, false);
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java
index be561aa5..c488b722 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java
@@ -22,7 +22,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Random;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
@@ -30,29 +29,25 @@ import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugin.testing.SilentLog;
 import org.apache.maven.plugins.dependency.testUtils.stubs.StubSourcesFileMarkerHandler;
-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 static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * @author brianf
  */
-public class TestSourcesMarkerFileHandler {
+class TestSourcesMarkerFileHandler {
     List<Artifact> artifacts = new ArrayList<>();
 
-    Log log = new SilentLog();
-
-    File outputFolder;
+    private File outputFolder;
 
     @BeforeEach
-    void setUp() throws Exception {
+    void setUp(@TempDir File tempDir) {
 
         ArtifactHandler ah = new DefaultArtifactHandler();
         VersionRange vr = VersionRange.createFromVersion("1.1");
@@ -65,18 +60,10 @@ public class TestSourcesMarkerFileHandler {
         artifact = new DefaultArtifact("test", "4", vr, Artifact.SCOPE_RUNTIME, "zip", "", ah, false);
         artifacts.add(artifact);
 
-        // pick random output location
-        Random a = new Random();
-        outputFolder = new File("target/markers" + a.nextLong() + "/");
-        outputFolder.delete();
+        outputFolder = new File(tempDir, "markers");
         assertFalse(outputFolder.exists());
     }
 
-    @AfterEach
-    void tearDown() {
-        outputFolder.delete();
-    }
-
     @Test
     void setMarkerResolved() throws Exception {
         DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler(artifacts.get(0), this.outputFolder, true);
@@ -197,8 +184,7 @@ public class TestSourcesMarkerFileHandler {
         doTestMarkerTimeStamp(false);
     }
 
-    public void doTestMarkerTimeStamp(boolean resolved)
-            throws MojoExecutionException, IOException, InterruptedException {
+    private void doTestMarkerTimeStamp(boolean resolved) throws MojoExecutionException, IOException {
         File theFile = new File(outputFolder, "theFile.jar");
         outputFolder.mkdirs();
         theFile.createNewFile();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java b/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
index 1ffea963..dc1d9658 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
@@ -18,59 +18,54 @@
  */
 package org.apache.maven.plugins.dependency.utils.translators;
 
-import java.util.HashMap;
+import javax.inject.Inject;
+
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.artifact.handler.manager.DefaultArtifactHandlerManager;
 import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugin.testing.SilentLog;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
 import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * @author brianf
  */
-public class TestClassifierTypeTranslator extends AbstractDependencyMojoTestCase {
+@MojoTest
+class TestClassifierTypeTranslator {
+
     Set<Artifact> artifacts = new HashSet<>();
 
-    Log log = new SilentLog();
+    @Inject
+    private Log log;
 
+    @Inject
     private ArtifactHandlerManager artifactHandlerManager;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "classifiertype-translator";
-    }
-
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        artifactHandlerManager = new DefaultArtifactHandlerManager();
-        this.setVariableValueToObject(artifactHandlerManager, "artifactHandlers", new HashMap<>());
-
+    @BeforeEach
+    void setUp() throws Exception {
         DependencyArtifactStubFactory factory = new DependencyArtifactStubFactory(null, false);
         artifacts = factory.getMixedArtifacts();
     }
 
-    public void testNullClassifier() {
+    @Test
+    void testNullClassifier() {
         doTestNullEmptyClassifier(null);
     }
 
-    public void testEmptyClassifier() {
+    @Test
+    void testEmptyClassifier() {
         doTestNullEmptyClassifier("");
     }
 
-    public void doTestNullEmptyClassifier(String classifier) {
+    private void doTestNullEmptyClassifier(String classifier) {
         String type = "zip";
 
         ArtifactTranslator at = new ClassifierTypeTranslator(artifactHandlerManager, classifier, type);
@@ -96,15 +91,17 @@ public class TestClassifierTypeTranslator extends AbstractDependencyMojoTestCase
         }
     }
 
-    public void testNullType() {
+    @Test
+    void testNullType() {
         doTestNullEmptyType(null);
     }
 
-    public void testEmptyType() {
+    @Test
+    void testEmptyType() {
         doTestNullEmptyType("");
     }
 
-    public void doTestNullEmptyType(String type) {
+    private void doTestNullEmptyType(String type) {
         String classifier = "jdk5";
 
         ArtifactTranslator at = new ClassifierTypeTranslator(artifactHandlerManager, classifier, type);
@@ -130,7 +127,8 @@ public class TestClassifierTypeTranslator extends AbstractDependencyMojoTestCase
         }
     }
 
-    public void testClassifierAndType() {
+    @Test
+    void testClassifierAndType() {
         String classifier = "jdk14";
         String type = "sources";
         ArtifactTranslator at = new ClassifierTypeTranslator(artifactHandlerManager, classifier, type);
@@ -154,7 +152,8 @@ public class TestClassifierTypeTranslator extends AbstractDependencyMojoTestCase
         }
     }
 
-    public void testGetterSetter() {
+    @Test
+    void testGetterSetter() {
         String classifier = "class";
         String type = "type";
         ClassifierTypeTranslator at = new ClassifierTypeTranslator(artifactHandlerManager, classifier, type);
diff --git a/src/test/resources/unit/collect-test/plugin-config.xml b/src/test/resources/unit/collect-test/plugin-config.xml
deleted file mode 100644
index 3d1210a5..00000000
--- a/src/test/resources/unit/collect-test/plugin-config.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-      <version>2.0.4</version>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/src/test/resources/unit/copy-dependencies-test/plugin-config.xml b/src/test/resources/unit/copy-dependencies-test/plugin-config.xml
deleted file mode 100644
index d2eb2b56..00000000
--- a/src/test/resources/unit/copy-dependencies-test/plugin-config.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <configuration>
-              <silent>true</silent>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/copy-test/plugin-config.xml b/src/test/resources/unit/copy-test/plugin-config.xml
deleted file mode 100644
index 1a046cae..00000000
--- a/src/test/resources/unit/copy-test/plugin-config.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <configuration>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-    <dependencies>
-        <dependency>
-          <groupId>org.apache.maven</groupId>
-          <artifactId>maven-artifact</artifactId>
-          <version>2.0.4</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/get-test/plugin-config.xml b/src/test/resources/unit/get-test/plugin-config.xml
deleted file mode 100644
index 45fab53a..00000000
--- a/src/test/resources/unit/get-test/plugin-config.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <groupId>org.apache.maven</groupId>
-          <artifactId>maven-model</artifactId>
-          <version>2.0.9</version>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-      <version>2.0.4</version>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/src/test/resources/unit/render-dependencies-test/plugin-config.xml b/src/test/resources/unit/render-dependencies-test/plugin-config.xml
deleted file mode 100644
index 1a046cae..00000000
--- a/src/test/resources/unit/render-dependencies-test/plugin-config.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <configuration>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-    <dependencies>
-        <dependency>
-          <groupId>org.apache.maven</groupId>
-          <artifactId>maven-artifact</artifactId>
-          <version>2.0.4</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/resolve-test/plugin-config.xml b/src/test/resources/unit/resolve-test/plugin-config.xml
deleted file mode 100644
index 1a046cae..00000000
--- a/src/test/resources/unit/resolve-test/plugin-config.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <configuration>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-    <dependencies>
-        <dependency>
-          <groupId>org.apache.maven</groupId>
-          <artifactId>maven-artifact</artifactId>
-          <version>2.0.4</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/tree-test/plugin-config.xml b/src/test/resources/unit/tree-test/plugin-config.xml
deleted file mode 100644
index 511d1147..00000000
--- a/src/test/resources/unit/tree-test/plugin-config.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <configuration>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-      <version>2.0.4</version>
-    </dependency>
-  </dependencies>
-</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml b/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml
deleted file mode 100644
index 30d2867c..00000000
--- a/src/test/resources/unit/unpack-dependencies-test/plugin-config.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <configuration>
-            <silent>true</silent>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/unpack-test/plugin-config.xml b/src/test/resources/unit/unpack-test/plugin-config.xml
deleted file mode 100644
index 1a046cae..00000000
--- a/src/test/resources/unit/unpack-test/plugin-config.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License. 
- *
--->
-<project>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <configuration>
-          </configuration>
-      </plugin>
-    </plugins>
-  </build>
-    <dependencies>
-        <dependency>
-          <groupId>org.apache.maven</groupId>
-          <artifactId>maven-artifact</artifactId>
-          <version>2.0.4</version>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file