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 4f045a21 Migration to JUnit 5 - avoid using AbstractMojoTestCase
4f045a21 is described below

commit 4f045a2134e1b09c48f1a6bc99b5cf051116e624
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Sat Nov 29 19:15:04 2025 +0100

    Migration to JUnit 5 - avoid using AbstractMojoTestCase
    
    Next part
---
 .../exclusion/AnalyzeExclusionsMojoTest.java       | 358 ++++++---------------
 .../fromDependencies/TestBuildClasspathMojo.java   | 103 +++---
 .../unit/analyze-exclusions/plugin-config.xml      |  43 ---
 .../unit/build-classpath-test/plugin-config.xml    |  37 ---
 4 files changed, 148 insertions(+), 393 deletions(-)

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 d0da7947..dfc9cfa5 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
@@ -18,187 +18,188 @@
  */
 package org.apache.maven.plugins.dependency.exclusion;
 
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
+import javax.inject.Inject;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 
-import org.apache.maven.RepositoryUtils;
-import org.apache.maven.artifact.Artifact;
+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;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.model.Exclusion;
 import org.apache.maven.model.InputLocation;
 import org.apache.maven.model.InputSource;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
-import 
org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
 import org.apache.maven.plugins.dependency.utils.ResolverUtil;
 import org.apache.maven.project.MavenProject;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.junit.jupiter.api.BeforeEach;
+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.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.lenient;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-public class AnalyzeExclusionsMojoTest extends AbstractDependencyMojoTestCase {
-
-    private AnalyzeExclusionsMojo mojo;
+@ExtendWith(MockitoExtension.class)
+@MojoTest
+class AnalyzeExclusionsMojoTest {
 
+    @Inject
     private MavenProject project;
 
-    private TestLog testLog;
+    @Inject
+    private MavenSession mavenSession;
 
-    private ResolverUtil resolverUtil;
+    @Mock
+    private Log testLog;
 
-    @Override
-    protected String getTestDirectoryName() {
-        return "analyze-exclusions";
+    @Provides
+    private Log testLogProvides() {
+        return testLog;
     }
 
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
+    @Mock
+    private ResolverUtil resolverUtil;
 
-    @Override
-    protected boolean shouldUseFlattenedPath() {
-        return false;
+    @Provides
+    private ResolverUtil resolverUtilProvides() {
+        return resolverUtil;
     }
 
-    @Override
+    @BeforeEach
     protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
-
-        project = new DependencyProjectStub();
-        project.setName("projectName");
-        project.setGroupId("testGroupId");
-        project.setArtifactId("testArtifactId");
-        project.setVersion("1.0.0");
-
-        getContainer().addComponent(project, MavenProject.class.getName());
-
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
-
-        resolverUtil = mock(ResolverUtil.class);
-        getContainer().addComponent(resolverUtil, 
ResolverUtil.class.getName());
+        when(project.getGroupId()).thenReturn("testGroupId");
+        when(project.getArtifactId()).thenReturn("testArtifactId");
+        when(project.getVersion()).thenReturn("1.0.0");
 
-        File testPom = new File(getBasedir(), 
"target/test-classes/unit/analyze-exclusions/plugin-config.xml");
-        mojo = (AnalyzeExclusionsMojo) lookupMojo("analyze-exclusions", 
testPom);
-        assertNotNull(mojo);
+        DependencyManagement dependencyManagement = 
mock(DependencyManagement.class);
+        
when(dependencyManagement.getDependencies()).thenReturn(Collections.emptyList());
+        
when(project.getDependencyManagement()).thenReturn(dependencyManagement);
 
-        testLog = new TestLog();
-        mojo.setLog(testLog);
+        lenient().when(mavenSession.getRepositorySession()).thenReturn(new 
DefaultRepositorySystemSession());
     }
 
-    public void testShallThrowExceptionWhenFailOnWarning() throws Exception {
+    @Test
+    @InjectMojo(goal = "analyze-exclusions")
+    @MojoParameter(name = "exclusionFail", value = "true")
+    void testShallThrowExceptionWhenFailOnWarning(AnalyzeExclusionsMojo mojo) 
throws Exception {
         List<Dependency> dependencies = new ArrayList<>();
         Dependency withInvalidExclusion = dependency("a", "b");
         withInvalidExclusion.addExclusion(exclusion("invalid", "invalid"));
         dependencies.add(withInvalidExclusion);
-        project.setDependencies(dependencies);
-        Artifact artifact = stubFactory.createArtifact("a", "b", "1.0");
-        project.setArtifacts(new 
HashSet<>(Collections.singletonList(artifact)));
-        setVariableValueToObject(mojo, "exclusionFail", true);
+        when(project.getDependencies()).thenReturn(dependencies);
 
-        assertThatThrownBy(() -> mojo.execute())
+        assertThatThrownBy(mojo::execute)
                 .isInstanceOf(MojoExecutionException.class)
                 .hasMessageContaining("Invalid exclusions found");
 
-        assertThat(testLog.getContent()).startsWith("[error]");
+        verify(testLog, times(3)).error(anyString());
     }
 
-    public void testShallLogWarningWhenFailOnWarningIsFalse() throws Exception 
{
+    @Test
+    @InjectMojo(goal = "analyze-exclusions")
+    @MojoParameter(name = "exclusionFail", value = "false")
+    void testShallLogWarningWhenFailOnWarningIsFalse(AnalyzeExclusionsMojo 
mojo) throws Exception {
         List<Dependency> dependencies = new ArrayList<>();
         Dependency withInvalidExclusion = dependency("a", "b");
         withInvalidExclusion.addExclusion(exclusion("invalid", "invalid"));
         dependencies.add(withInvalidExclusion);
-        project.setDependencies(dependencies);
-        Artifact artifact = stubFactory.createArtifact("a", "b", "1.0");
-        project.setArtifacts(new 
HashSet<>(Collections.singletonList(artifact)));
-        setVariableValueToObject(mojo, "exclusionFail", false);
+        when(project.getDependencies()).thenReturn(dependencies);
 
         mojo.execute();
 
-        assertThat(testLog.getContent()).startsWith("[warn]");
+        verify(testLog, times(3)).warn(anyString());
     }
 
-    public void testShallExitWithoutAnalyzeWhenNoDependencyHasExclusion() 
throws Exception {
+    @Test
+    @InjectMojo(goal = "analyze-exclusions")
+    void 
testShallExitWithoutAnalyzeWhenNoDependencyHasExclusion(AnalyzeExclusionsMojo 
mojo) throws Exception {
         List<Dependency> dependencies = new ArrayList<>();
         dependencies.add(dependency("a", "c"));
-        project.setDependencies(dependencies);
+        when(project.getDependencies()).thenReturn(dependencies);
+
         mojo.execute();
-        assertThat(testLog.getContent()).startsWith("[debug] No dependencies 
defined with exclusions - exiting");
+        verify(testLog).debug("No dependencies defined with exclusions - 
exiting");
     }
 
-    public void 
testShallNotReportInvalidExclusionForWildcardGroupIdAndArtifactId() throws 
Exception {
+    @Test
+    @InjectMojo(goal = "analyze-exclusions")
+    void 
testShallNotReportInvalidExclusionForWildcardGroupIdAndArtifactId(AnalyzeExclusionsMojo
 mojo)
+            throws Exception {
         Dependency dependencyWithWildcardExclusion = dependency("a", "b");
         dependencyWithWildcardExclusion.addExclusion(exclusion("*", "*"));
-        
project.setDependencies(Collections.singletonList(dependencyWithWildcardExclusion));
-        Artifact artifact = stubFactory.createArtifact("a", "b", "1.0");
-        project.setArtifacts(new 
HashSet<>(Collections.singletonList(artifact)));
+        
when(project.getDependencies()).thenReturn(Collections.singletonList(dependencyWithWildcardExclusion));
 
         when(resolverUtil.collectDependencies(any()))
                 .thenReturn(Collections.singletonList(new 
org.eclipse.aether.graph.Dependency(
-                        
RepositoryUtils.toArtifact(stubFactory.createArtifact("whatever", "ok", 
"1.0")), "")));
+                        new DefaultArtifact("whatever", "ok", "jar", "1.0"), 
"")));
 
         mojo.execute();
-
-        assertThat(testLog.getContent()).doesNotContain("[warn]     a:b:", 
"[warn]         - *:*");
+        verify(testLog, never()).warn(anyString());
     }
 
-    public void testCanResolveMultipleArtifactsWithEqualGroupIdAndArtifactId() 
throws Exception {
+    @Test
+    @InjectMojo(goal = "analyze-exclusions")
+    void 
testCanResolveMultipleArtifactsWithEqualGroupIdAndArtifactId(AnalyzeExclusionsMojo
 mojo) throws Exception {
         Dependency dependency1 = dependency("a", "b");
         Dependency dependency2 = dependency("a", "b", "compile", "native");
         dependency1.addExclusion(exclusion("c", "d"));
         dependency2.addExclusion(exclusion("c", "d"));
-        project.setDependencies(Arrays.asList(dependency1, dependency2));
-        Artifact artifact1 = stubFactory.createArtifact("a", "b", "1.0");
-        Artifact artifact2 = stubFactory.createArtifact("a", "b", "1.0", 
"compile", "jar", "native");
-        project.setArtifacts(new HashSet<>(Arrays.asList(artifact1, 
artifact2)));
+        when(project.getDependencies()).thenReturn(Arrays.asList(dependency1, 
dependency2));
 
-        assertThatCode(() -> mojo.execute()).doesNotThrowAnyException();
+        assertThatCode(mojo::execute).doesNotThrowAnyException();
     }
 
-    public void testShallNotLogWhenExclusionIsValid() throws Exception {
+    @Test
+    @InjectMojo(goal = "analyze-exclusions")
+    void testShallNotLogWhenExclusionIsValid(AnalyzeExclusionsMojo mojo) 
throws Exception {
         List<Dependency> dependencies = new ArrayList<>();
         Dependency dependency = dependency("a", "b");
         dependency.addExclusion(exclusion("ok", "ok"));
         dependencies.add(dependency);
-        project.setDependencies(dependencies);
-        Artifact artifact = stubFactory.createArtifact("a", "b", "1.0");
-
-        project.setArtifacts(new 
HashSet<>(Collections.singletonList(artifact)));
-        setVariableValueToObject(mojo, "exclusionFail", true);
+        when(project.getDependencies()).thenReturn(dependencies);
 
         when(resolverUtil.collectDependencies(any()))
-                .thenReturn(Collections.singletonList(new 
org.eclipse.aether.graph.Dependency(
-                        
RepositoryUtils.toArtifact(stubFactory.createArtifact("ok", "ok", "1.0")), 
"")));
+                .thenReturn(Collections.singletonList(
+                        new org.eclipse.aether.graph.Dependency(new 
DefaultArtifact("ok", "ok", "jar", "1.0"), "")));
 
-        assertThatCode(() -> mojo.execute()).doesNotThrowAnyException();
+        assertThatCode(mojo::execute).doesNotThrowAnyException();
+
+        verify(testLog, never()).warn(anyString());
     }
 
-    public void testThatLogContainProjectName() throws Exception {
+    @Test
+    @InjectMojo(goal = "analyze-exclusions")
+    void testThatLogContainProjectName(AnalyzeExclusionsMojo mojo) throws 
Exception {
         List<Dependency> dependencies = new ArrayList<>();
         Dependency withInvalidExclusion = dependency("a", "b");
         withInvalidExclusion.addExclusion(exclusion("invalid", "invalid"));
         dependencies.add(withInvalidExclusion);
-        project.setDependencies(dependencies);
-        Artifact artifact = stubFactory.createArtifact("a", "b", "1.0");
-        project.setArtifacts(new 
HashSet<>(Collections.singletonList(artifact)));
+        when(project.getDependencies()).thenReturn(dependencies);
+
+        when(project.getName()).thenReturn("projectName");
 
         mojo.execute();
 
-        assertThat(testLog.getContent()).contains("[warn] projectName defines 
following unnecessary excludes");
+        verify(testLog).warn("projectName defines following unnecessary 
excludes");
     }
 
     private Dependency dependency(String groupId, String artifactId) {
@@ -234,183 +235,4 @@ public class AnalyzeExclusionsMojoTest extends 
AbstractDependencyMojoTestCase {
         exclusion.setLocation("", new InputLocation(1, 1, inputSource));
         return exclusion;
     }
-
-    static class TestLog implements Log {
-        StringBuilder sb = new StringBuilder();
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void debug(CharSequence content) {
-            print("debug", content);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void debug(CharSequence content, Throwable error) {
-            print("debug", content, error);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void debug(Throwable error) {
-            print("debug", error);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void info(CharSequence content) {
-            print("info", content);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void info(CharSequence content, Throwable error) {
-            print("info", content, error);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void info(Throwable error) {
-            print("info", error);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void warn(CharSequence content) {
-            print("warn", content);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void warn(CharSequence content, Throwable error) {
-            print("warn", content, error);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void warn(Throwable error) {
-            print("warn", error);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void error(CharSequence content) {
-            print("error", content);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public void error(CharSequence content, Throwable error) {
-            StringWriter sWriter = new StringWriter();
-            PrintWriter pWriter = new PrintWriter(sWriter);
-
-            error.printStackTrace(pWriter);
-
-            System.err.println(
-                    "[error] " + content.toString() + System.lineSeparator() + 
System.lineSeparator() + sWriter);
-        }
-
-        /**
-         * @see org.apache.maven.plugin.logging.Log#error(java.lang.Throwable)
-         */
-        @Override
-        public void error(Throwable error) {
-            StringWriter sWriter = new StringWriter();
-            PrintWriter pWriter = new PrintWriter(sWriter);
-
-            error.printStackTrace(pWriter);
-
-            System.err.println("[error] " + sWriter);
-        }
-
-        /**
-         * @see org.apache.maven.plugin.logging.Log#isDebugEnabled()
-         */
-        @Override
-        public boolean isDebugEnabled() {
-            return false;
-        }
-
-        /**
-         * @see org.apache.maven.plugin.logging.Log#isInfoEnabled()
-         */
-        @Override
-        public boolean isInfoEnabled() {
-            return true;
-        }
-
-        /**
-         * @see org.apache.maven.plugin.logging.Log#isWarnEnabled()
-         */
-        @Override
-        public boolean isWarnEnabled() {
-            return true;
-        }
-
-        /**
-         * @see org.apache.maven.plugin.logging.Log#isErrorEnabled()
-         */
-        @Override
-        public boolean isErrorEnabled() {
-            return true;
-        }
-
-        private void print(String prefix, CharSequence content) {
-            sb.append("[")
-                    .append(prefix)
-                    .append("] ")
-                    .append(content.toString())
-                    .append(System.lineSeparator());
-        }
-
-        private void print(String prefix, Throwable error) {
-            StringWriter sWriter = new StringWriter();
-            PrintWriter pWriter = new PrintWriter(sWriter);
-
-            error.printStackTrace(pWriter);
-
-            sb.append("[").append(prefix).append("] 
").append(sWriter).append(System.lineSeparator());
-        }
-
-        private void print(String prefix, CharSequence content, Throwable 
error) {
-            StringWriter sWriter = new StringWriter();
-            PrintWriter pWriter = new PrintWriter(sWriter);
-
-            error.printStackTrace(pWriter);
-
-            sb.append("[")
-                    .append(prefix)
-                    .append("] ")
-                    .append(content.toString())
-                    .append(System.lineSeparator())
-                    .append(System.lineSeparator());
-            sb.append(sWriter).append(System.lineSeparator());
-        }
-
-        protected String getContent() {
-            return sb.toString();
-        }
-    }
 }
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 86856c63..5726e35d 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
@@ -18,61 +18,55 @@
  */
 package org.apache.maven.plugins.dependency.fromDependencies;
 
+import javax.inject.Inject;
+
 import java.io.File;
+import java.util.HashSet;
 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.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
 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.utils.DependencyUtil;
 import org.apache.maven.project.MavenProject;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.mockito.Mockito;
 
-public class TestBuildClasspathMojo extends AbstractDependencyMojoTestCase {
-
-    private BuildClasspathMojo mojo;
-
-    @Override
-    protected String getTestDirectoryName() {
-        return "build-classpath";
-    }
-
-    @Override
-    protected boolean shouldCreateFiles() {
-        return true;
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        // required for mojo lookups to work
-        super.setUp();
+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.assertNotNull;
+import static org.junit.jupiter.api.AssertionsKt.assertNull;
+import static org.mockito.Mockito.when;
 
-        MavenProject project = new DependencyProjectStub();
-        getContainer().addComponent(project, MavenProject.class.getName());
+@MojoTest
+public class TestBuildClasspathMojo {
 
-        MavenSession session = newMavenSession(project);
-        getContainer().addComponent(session, MavenSession.class.getName());
+    @TempDir
+    private File testDir;
 
-        File testPom = new File(getBasedir(), 
"target/test-classes/unit/build-classpath-test/plugin-config.xml");
-        mojo = (BuildClasspathMojo) lookupMojo("build-classpath", testPom);
+    @Inject
+    private MavenSession session;
 
-        assertNotNull(mojo);
-        assertNotNull(mojo.getProject());
-    }
+    @Inject
+    private MavenProject project;
 
     /**
      * Tests the proper discovery and configuration of the mojo.
      */
-    public void testEnvironment() throws Exception {
-        MavenProject project = mojo.getProject();
-
-        Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
-        Set<Artifact> directArtifacts = 
this.stubFactory.getReleaseAndSnapshotArtifacts();
-        artifacts.addAll(directArtifacts);
+    @Test
+    @InjectMojo(goal = "build-classpath")
+    public void testEnvironment(BuildClasspathMojo mojo) throws Exception {
 
-        project.setArtifacts(artifacts);
-        project.setDependencyArtifacts(directArtifacts);
+        Set<Artifact> artifacts = getArtifacts();
+        when(project.getArtifacts()).thenReturn(artifacts);
 
         mojo.execute();
         try {
@@ -117,13 +111,19 @@ public class TestBuildClasspathMojo extends 
AbstractDependencyMojoTestCase {
         assertNotNull(propertyValue);
     }
 
-    public void testPath() throws Exception {
+    @Test
+    @InjectMojo(goal = "build-classpath")
+    public void testPath(BuildClasspathMojo mojo) throws Exception {
 
-        LegacySupport legacySupport = lookup(LegacySupport.class);
-        legacySupport.setSession(lookup(MavenSession.class));
-        installLocalRepository(legacySupport);
+        File localRepo = new File(testDir, "local-rep").getAbsoluteFile();
 
-        Artifact artifact = stubFactory.getReleaseArtifact();
+        RepositorySystemSession repoSession = 
Mockito.mock(RepositorySystemSession.class);
+        when(repoSession.getLocalRepository()).thenReturn(new 
LocalRepository(localRepo));
+        when(session.getRepositorySession()).thenReturn(repoSession);
+
+        Artifact artifact = new DefaultArtifact(
+                "testGroupId", "release", "1.0", null, "jar", "", new 
DefaultArtifactHandler("jar"));
+        artifact.setFile(new File(localRepo, "release-1.0.jar"));
 
         StringBuilder sb = new StringBuilder();
         mojo.setPrefix(null);
@@ -146,9 +146,9 @@ public class TestBuildClasspathMojo extends 
AbstractDependencyMojoTestCase {
         mojo.setPrependGroupId(true);
         mojo.appendArtifactPath(artifact, sb);
         assertEquals(
-                "If prefix is null, prependGroupId has no impact ",
                 "%M2_REPO%" + File.separator + 
DependencyUtil.getFormattedFileName(artifact, false, false),
-                sb.toString());
+                sb.toString(),
+                "If prefix is null, prependGroupId has no impact ");
 
         mojo.setLocalRepoProperty("");
         mojo.setPrefix("prefix");
@@ -171,4 +171,17 @@ public class TestBuildClasspathMojo extends 
AbstractDependencyMojoTestCase {
         mojo.appendArtifactPath(artifact, sb);
         assertEquals("prefix" + File.separator + 
DependencyUtil.getFormattedFileName(artifact, true), sb.toString());
     }
+
+    private Set<Artifact> getArtifacts() {
+        Artifact artifact1 = new DefaultArtifact(
+                "testGroupId", "release1", "1.0", null, "jar", "", new 
DefaultArtifactHandler("jar"));
+        artifact1.setFile(new File(testDir, "local-repo/release1-1.0.jar"));
+        Artifact artifact2 = new DefaultArtifact(
+                "testGroupId", "release2", "1.0", null, "jar", "", new 
DefaultArtifactHandler("jar"));
+        artifact2.setFile(new File(testDir, "local-repo/release2-1.0.jar"));
+        Set<Artifact> artifacts = new HashSet<>();
+        artifacts.add(artifact1);
+        artifacts.add(artifact2);
+        return artifacts;
+    }
 }
diff --git a/src/test/resources/unit/analyze-exclusions/plugin-config.xml 
b/src/test/resources/unit/analyze-exclusions/plugin-config.xml
deleted file mode 100644
index ccf9ebde..00000000
--- a/src/test/resources/unit/analyze-exclusions/plugin-config.xml
+++ /dev/null
@@ -1,43 +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>
-          <exclusions>
-            <exclusion>
-              <groupId>javax.inject</groupId>
-              <artifactId>javax.inject</artifactId>
-            </exclusion>
-          </exclusions>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/build-classpath-test/plugin-config.xml 
b/src/test/resources/unit/build-classpath-test/plugin-config.xml
deleted file mode 100644
index 1a046cae..00000000
--- a/src/test/resources/unit/build-classpath-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

Reply via email to