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 206c8cd8 Migration to JUnit 5
206c8cd8 is described below
commit 206c8cd8711b64b25025adb84e3e776451d5f193
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Thu Nov 13 19:25:12 2025 +0100
Migration to JUnit 5
---
.../apache/maven/plugins/dependency/TestSkip.java | 251 ++++++++++++---------
.../dependency/exclusion/ExclusionCheckerTest.java | 20 +-
.../fromConfiguration/TestArtifactItem.java | 29 +--
.../TestIncludeExcludeUnpackMojo.java | 14 +-
.../testUtils/DependencyArtifactStubFactory.java | 6 +-
.../plugins/dependency/utils/TestSilentLog.java | 17 +-
.../utils/markers/TestUnpackMarkerFileHandler.java | 42 ++--
.../skip-test/plugin-analyze-report-config.xml | 45 ----
.../resources/unit/skip-test/plugin-config.xml | 44 ----
.../resources/unit/skip-test/plugin-get-config.xml | 44 ----
.../plugin-purge-local-repository-config.xml | 44 ----
11 files changed, 197 insertions(+), 359 deletions(-)
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 1fbcacb0..2330a6c5 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
@@ -18,165 +18,200 @@
*/
package org.apache.maven.plugins.dependency;
-import java.io.File;
+import javax.inject.Inject;
-import org.apache.maven.execution.MavenSession;
+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.model.Plugin;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.logging.Log;
-import
org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
-import org.apache.maven.project.MavenProject;
-import org.mockito.ArgumentCaptor;
-
-import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.mock;
+import org.apache.maven.plugins.dependency.analyze.AnalyzeDepMgt;
+import org.apache.maven.plugins.dependency.analyze.AnalyzeDuplicateMojo;
+import org.apache.maven.plugins.dependency.analyze.AnalyzeMojo;
+import org.apache.maven.plugins.dependency.analyze.AnalyzeOnlyMojo;
+import org.apache.maven.plugins.dependency.analyze.AnalyzeReport;
+import org.apache.maven.plugins.dependency.fromConfiguration.CopyMojo;
+import org.apache.maven.plugins.dependency.fromConfiguration.UnpackMojo;
+import org.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo;
+import
org.apache.maven.plugins.dependency.fromDependencies.CopyDependenciesMojo;
+import
org.apache.maven.plugins.dependency.fromDependencies.UnpackDependenciesMojo;
+import org.apache.maven.plugins.dependency.resolvers.GoOfflineMojo;
+import org.apache.maven.plugins.dependency.resolvers.ListMojo;
+import
org.apache.maven.plugins.dependency.resolvers.OldResolveDependencySourcesMojo;
+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;
-public class TestSkip extends AbstractDependencyMojoTestCase {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- MavenProject project = new DependencyProjectStub();
- getContainer().addComponent(project, MavenProject.class.getName());
+@ExtendWith(MockitoExtension.class)
+@MojoTest
+class TestSkip {
- MavenSession session = newMavenSession(project);
- getContainer().addComponent(session, MavenSession.class.getName());
- }
-
- public void testSkipAnalyze() throws Exception {
- doTest("analyze");
- }
+ @Inject
+ private MojoExecution mojoExecution;
- public void testSkipAnalyzeDepMgt() throws Exception {
- doTest("analyze-dep-mgt");
- }
+ @Mock
+ private Log log;
- public void testSkipAnalyzeOnly() throws Exception {
- doTest("analyze-only");
+ @Provides
+ private Log logProvides() {
+ return log;
}
- public void testSkipAnalyzeReport() throws Exception {
- doSpecialTest("analyze-report", true);
+ @Test
+ @InjectMojo(goal = "analyze")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipAnalyze(AnalyzeMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipAnalyzeDuplicate() throws Exception {
- doTest("analyze-duplicate");
+ @Test
+ @InjectMojo(goal = "analyze-dep-mgt")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipAnalyzeDepMgt(AnalyzeDepMgt mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipBuildClasspath() throws Exception {
- doTest("build-classpath");
+ @Test
+ @InjectMojo(goal = "analyze-only")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipAnalyzeOnly(AnalyzeOnlyMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipCopy() throws Exception {
- doTest("copy");
- }
+ @Test
+ @InjectMojo(goal = "analyze-report")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipAnalyzeReport(AnalyzeReport mojo) throws Exception {
+ Plugin plugin = new Plugin();
+ plugin.setArtifactId("maven-dependency-plugin");
+ plugin.setVersion("1.0.0");
+ when(mojoExecution.getPlugin()).thenReturn(plugin);
+ when(mojoExecution.getGoal()).thenReturn("analyze-report");
- public void testSkipCopyDependencies() throws Exception {
- doTest("copy-dependencies");
+ mojo.execute();
+ verify(log)
+ .info(contains(
+ "Skipping
org.apache.maven.plugins:maven-dependency-plugin:1.0.0:analyze-report report
goal"));
}
- public void testSkipGet() throws Exception {
- doSpecialTest("get");
+ @Test
+ @InjectMojo(goal = "analyze-duplicate")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipAnalyzeDuplicate(AnalyzeDuplicateMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipGoOffline() throws Exception {
- doTest("go-offline");
+ @Test
+ @InjectMojo(goal = "build-classpath")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipBuildClasspath(BuildClasspathMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipList() throws Exception {
- doTest("list");
+ @Test
+ @InjectMojo(goal = "copy")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipCopy(CopyMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipProperties() throws Exception {
- doTest("properties");
+ @Test
+ @InjectMojo(goal = "copy-dependencies")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipCopyDependencies(CopyDependenciesMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipPurgeLocalRepository() throws Exception {
- doSpecialTest("purge-local-repository");
+ @Test
+ @InjectMojo(goal = "get")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipGet(GetMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipResolve() throws Exception {
- doTest("resolve");
+ @Test
+ @InjectMojo(goal = "go-offline")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipGoOffline(GoOfflineMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipResolvePlugins() throws Exception {
- doTest("resolve-plugins");
+ @Test
+ @InjectMojo(goal = "list")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipList(ListMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipSources() throws Exception {
- doTest("sources");
+ @Test
+ @InjectMojo(goal = "properties")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipProperties(PropertiesMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipTree() throws Exception {
- doTest("tree");
+ @Test
+ @InjectMojo(goal = "purge-local-repository")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipPurgeLocalRepository(PurgeLocalRepositoryMojo mojo) throws
Exception {
+ doTest(mojo);
}
- public void testSkipUnpack() throws Exception {
- doTest("unpack");
+ @Test
+ @InjectMojo(goal = "resolve")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipResolve(ResolveDependenciesMojo mojo) throws Exception {
+ doTest(mojo);
}
- public void testSkipUnpackDependencies() throws Exception {
- doTest("unpack-dependencies");
+ @Test
+ @InjectMojo(goal = "resolve-plugins")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipResolvePlugins(ResolvePluginsMojo mojo) throws Exception {
+ doTest(mojo);
}
- protected void doTest(String mojoName) throws Exception {
- doConfigTest(mojoName, "plugin-config.xml");
+ @Test
+ @InjectMojo(goal = "sources")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipSources(OldResolveDependencySourcesMojo mojo) throws
Exception {
+ doTest(mojo);
}
- protected void doSpecialTest(String mojoName) throws Exception {
- doConfigTest(mojoName, "plugin-" + mojoName + "-config.xml", false);
+ @Test
+ @InjectMojo(goal = "tree")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipTree(TreeMojo mojo) throws Exception {
+ doTest(mojo);
}
- protected void doSpecialTest(String mojoName, boolean addMojoExecution)
throws Exception {
- doConfigTest(mojoName, "plugin-" + mojoName + "-config.xml",
addMojoExecution);
+ @Test
+ @InjectMojo(goal = "unpack")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipUnpack(UnpackMojo mojo) throws Exception {
+ doTest(mojo);
}
- private void doConfigTest(String mojoName, String configFile) throws
Exception {
- doConfigTest(mojoName, configFile, false);
+ @Test
+ @InjectMojo(goal = "unpack-dependencies")
+ @MojoParameter(name = "skip", value = "true")
+ void testSkipUnpackDependencies(UnpackDependenciesMojo mojo) throws
Exception {
+ doTest(mojo);
}
- private void doConfigTest(String mojoName, String configFile, boolean
addMojoExecution) throws Exception {
- File testPom = new File(getBasedir(),
"target/test-classes/unit/skip-test/" + configFile);
- Mojo mojo = lookupMojo(mojoName, testPom);
- assertNotNull("Mojo not found.", mojo);
-
- if (addMojoExecution) {
- setVariableValueToObject(mojo, "mojoExecution",
getMockMojoExecution(mojoName));
- }
- Log log = mock(Log.class);
- mojo.setLog(log);
+ private void doTest(Mojo mojo) throws Exception {
mojo.execute();
-
- ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
- verify(log, atLeastOnce()).info(captor.capture());
- String skipMessage;
- if (addMojoExecution) {
- MojoExecution me = getMockMojoExecution(mojoName);
- String reportMojoInfo = me.getPlugin().getId() + ":" +
me.getGoal();
- skipMessage = "Skipping " + reportMojoInfo + " report goal";
- } else {
- skipMessage = "Skipping plugin execution";
- }
- assertTrue(captor.getValue().contains(skipMessage));
- }
-
- private MojoExecution getMockMojoExecution(String goal) {
- MojoDescriptor md = new MojoDescriptor();
- md.setGoal(goal);
-
- MojoExecution me = new MojoExecution(md);
-
- PluginDescriptor pd = new PluginDescriptor();
- Plugin p = new Plugin();
- p.setGroupId("org.apache.maven.plugins");
- p.setArtifactId("maven-dependency-plugin");
- pd.setPlugin(p);
- md.setPluginDescriptor(pd);
-
- return me;
+ verify(log).info(contains("Skipping plugin"));
}
}
diff --git
a/src/test/java/org/apache/maven/plugins/dependency/exclusion/ExclusionCheckerTest.java
b/src/test/java/org/apache/maven/plugins/dependency/exclusion/ExclusionCheckerTest.java
index ad97c810..2663595d 100644
---
a/src/test/java/org/apache/maven/plugins/dependency/exclusion/ExclusionCheckerTest.java
+++
b/src/test/java/org/apache/maven/plugins/dependency/exclusion/ExclusionCheckerTest.java
@@ -23,23 +23,23 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static
org.apache.maven.plugins.dependency.exclusion.Coordinates.coordinates;
import static org.assertj.core.api.Assertions.assertThat;
-public class ExclusionCheckerTest {
+class ExclusionCheckerTest {
private ExclusionChecker checker;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
checker = new ExclusionChecker();
}
@Test
- public void shallReportInvalidExclusions() {
+ void shallReportInvalidExclusions() {
Coordinates artifact = coordinates("com.current", "artifact");
Set<Coordinates> excludes = new HashSet<>(Arrays.asList(
coordinates("com.example", "one"),
@@ -59,13 +59,13 @@ public class ExclusionCheckerTest {
}
@Test
- public void noViolationsWhenEmptyExclusions() {
+ void noViolationsWhenEmptyExclusions() {
checker.check(coordinates("a", "b"), new HashSet<>(), new HashSet<>());
assertThat(checker.getViolations()).isEmpty();
}
@Test
- public void shallReportInvalidExclusionsWhenNoDependencies() {
+ void shallReportInvalidExclusionsWhenNoDependencies() {
Coordinates artifact = coordinates("a", "b");
HashSet<Coordinates> actualDependencies = new HashSet<>();
checker.check(artifact, new
HashSet<>(Collections.singletonList(coordinates("p", "m"))),
actualDependencies);
@@ -73,7 +73,7 @@ public class ExclusionCheckerTest {
}
@Test
- public void shallHandleWildcardExclusions() {
+ void shallHandleWildcardExclusions() {
Coordinates artifact = coordinates("com.current", "artifact");
Set<Coordinates> excludes = new
HashSet<>(Collections.singletonList(coordinates("*", "*")));
@@ -86,7 +86,7 @@ public class ExclusionCheckerTest {
}
@Test
- public void shallHandleWildcardGroupIdExclusion() {
+ void shallHandleWildcardGroupIdExclusion() {
Coordinates artifact = coordinates("com.current", "artifact");
Set<Coordinates> excludes = new
HashSet<>(Collections.singletonList(coordinates("javax", "*")));
diff --git
a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestArtifactItem.java
b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestArtifactItem.java
index 63fefb1d..f29043cd 100644
---
a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestArtifactItem.java
+++
b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestArtifactItem.java
@@ -21,28 +21,16 @@ package
org.apache.maven.plugins.dependency.fromConfiguration;
import java.io.IOException;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.junit.jupiter.api.Test;
-public class TestArtifactItem extends AbstractDependencyMojoTestCase {
+import static org.junit.jupiter.api.Assertions.assertEquals;
- @Override
- protected String getTestDirectoryName() {
- return "artifactItems";
- }
-
- @Override
- protected boolean shouldCreateFiles() {
- return false;
- }
-
- @Override
- protected void setUp() throws Exception {
- // required for mojo lookups to work
- super.setUp();
- }
+class TestArtifactItem {
- public void testArtifactItemConstructor() throws IOException {
- Artifact artifact = stubFactory.createArtifact("g", "a", "1.0",
Artifact.SCOPE_COMPILE, "jar", "one");
+ @Test
+ void testArtifactItemConstructor() throws IOException {
+ Artifact artifact = new DefaultArtifact("g", "a", "1.0",
Artifact.SCOPE_COMPILE, "jar", "one", null);
ArtifactItem item = new ArtifactItem(artifact);
@@ -54,7 +42,8 @@ public class TestArtifactItem extends
AbstractDependencyMojoTestCase {
assertEquals(item.getType(), artifact.getType());
}
- public void testArtifactItemDefaultType() {
+ @Test
+ void testArtifactItemDefaultType() {
ArtifactItem item = new ArtifactItem();
// check type default
assertEquals("jar", item.getType());
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 f42e42ae..4d1ff3ed 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
@@ -77,7 +77,7 @@ public class TestIncludeExcludeUnpackMojo extends
AbstractDependencyMojoTestCase
// 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 = stubFactory.getArtifactItem(artifact);
+ ArtifactItem item = new ArtifactItem(artifact);
List<ArtifactItem> list = new ArrayList<>(1);
list.add(item);
assertNotNull(mojo);
@@ -205,7 +205,7 @@ public class TestIncludeExcludeUnpackMojo extends
AbstractDependencyMojoTestCase
public void testIncludeArtifactItemOverride() throws Exception {
Artifact artifact = stubFactory.createArtifact("test", "test", "1.0",
Artifact.SCOPE_COMPILE, "jar", null);
- ArtifactItem item = stubFactory.getArtifactItem(artifact);
+ ArtifactItem item = new ArtifactItem(artifact);
item.setIncludes("**/*");
List<ArtifactItem> list = new ArrayList<>(1);
list.add(item);
@@ -220,7 +220,7 @@ public class TestIncludeExcludeUnpackMojo extends
AbstractDependencyMojoTestCase
public void testExcludeArtifactItemOverride() throws Exception {
Artifact artifact = stubFactory.createArtifact("test", "test", "1.0",
Artifact.SCOPE_COMPILE, "jar", null);
- ArtifactItem item = stubFactory.getArtifactItem(artifact);
+ ArtifactItem item = new ArtifactItem(artifact);
item.setExcludes("**/*");
List<ArtifactItem> list = new ArrayList<>(1);
list.add(item);
@@ -236,11 +236,11 @@ public class TestIncludeExcludeUnpackMojo extends
AbstractDependencyMojoTestCase
public void testIncludeArtifactItemMultipleMarker() throws Exception {
List<ArtifactItem> list = new ArrayList<>();
Artifact artifact = stubFactory.createArtifact("test", "test", "1.0",
Artifact.SCOPE_COMPILE, "jar", null);
- ArtifactItem item = stubFactory.getArtifactItem(artifact);
+ ArtifactItem item = new ArtifactItem(artifact);
item.setOverWrite("false");
item.setIncludes("**/test2" + UNPACKED_FILE_SUFFIX);
list.add(item);
- item = stubFactory.getArtifactItem(artifact);
+ item = new ArtifactItem(artifact);
item.setOverWrite("false");
item.setIncludes("**/test3" + UNPACKED_FILE_SUFFIX);
list.add(item);
@@ -256,11 +256,11 @@ public class TestIncludeExcludeUnpackMojo extends
AbstractDependencyMojoTestCase
public void testIncludeArtifactItemMultipleExecutions() throws Exception {
List<ArtifactItem> list = new ArrayList<>();
Artifact artifact = stubFactory.createArtifact("test", "test", "1.0",
Artifact.SCOPE_COMPILE, "jar", null);
- ArtifactItem item = stubFactory.getArtifactItem(artifact);
+ ArtifactItem item = new ArtifactItem(artifact);
item.setOverWrite("false");
item.setIncludes("**/test2" + UNPACKED_FILE_SUFFIX);
list.add(item);
- item = stubFactory.getArtifactItem(artifact);
+ item = new ArtifactItem(artifact);
item.setOverWrite("false");
item.setIncludes("**/test3" + UNPACKED_FILE_SUFFIX);
list.add(item);
diff --git
a/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java
b/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java
index 05a52ef9..163167b0 100644
---
a/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java
+++
b/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java
@@ -52,14 +52,10 @@ public class DependencyArtifactStubFactory extends
ArtifactStubFactory {
super(theWorkingDir, theCreateFiles);
}
- public ArtifactItem getArtifactItem(Artifact artifact) {
- return new ArtifactItem(artifact);
- }
-
public List<ArtifactItem> getArtifactItems(Collection<Artifact> artifacts)
{
List<ArtifactItem> list = new ArrayList<>();
for (Artifact artifact : artifacts) {
- list.add(getArtifactItem(artifact));
+ list.add(new ArtifactItem(artifact));
}
return list;
}
diff --git
a/src/test/java/org/apache/maven/plugins/dependency/utils/TestSilentLog.java
b/src/test/java/org/apache/maven/plugins/dependency/utils/TestSilentLog.java
index 025e4233..c70fc0ff 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/TestSilentLog.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/TestSilentLog.java
@@ -19,13 +19,14 @@
package org.apache.maven.plugins.dependency.utils;
import org.apache.maven.plugin.logging.Log;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class TestSilentLog {
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+class TestSilentLog {
@Test
- public void testLog() {
+ void testLog() {
Log log = new DependencySilentLog();
String text = "Text";
Throwable e = new RuntimeException();
@@ -41,9 +42,9 @@ public class TestSilentLog {
log.error(text);
log.error(text, e);
log.error(e);
- Assert.assertFalse(log.isDebugEnabled());
- Assert.assertFalse(log.isErrorEnabled());
- Assert.assertFalse(log.isWarnEnabled());
- Assert.assertFalse(log.isInfoEnabled());
+ assertFalse(log.isDebugEnabled());
+ assertFalse(log.isErrorEnabled());
+ assertFalse(log.isWarnEnabled());
+ assertFalse(log.isInfoEnabled());
}
}
diff --git
a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java
b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java
index 0609a0e9..8c7ad453 100644
---
a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java
+++
b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java
@@ -23,46 +23,40 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem;
-import
org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
import
org.apache.maven.plugins.dependency.testUtils.stubs.StubUnpackFileMarkerHandler;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
-class TestUnpackMarkerFileHandler extends AbstractMojoTestCase {
- List<ArtifactItem> artifactItems = new ArrayList<>();
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.AssertionsKt.assertNull;
- @TempDir
- File outputFolder;
+class TestUnpackMarkerFileHandler {
+ private List<ArtifactItem> artifactItems = new ArrayList<>();
@TempDir
- protected File testDir;
-
- protected DependencyArtifactStubFactory stubFactory;
+ private File outputFolder;
- @Override
@BeforeEach
- protected void setUp() throws Exception {
- super.setUp();
-
- stubFactory = new DependencyArtifactStubFactory(this.testDir, false);
- Artifact artifact = stubFactory.createArtifact("test", "test", "1");
- ArtifactItem artifactItem;
- stubFactory.getArtifactItem(artifact);
-
artifactItems.add(stubFactory.getArtifactItem(stubFactory.createArtifact("test",
"test", "1")));
- artifact = stubFactory.createArtifact("test2", "test2", "2");
- artifactItem = new ArtifactItem(artifact);
+ void setUp() {
+ ArtifactItem artifactItem = new ArtifactItem(new
DefaultArtifact("test", "test", "1", null, "jar", "", null));
+ artifactItems.add(artifactItem);
+
+ artifactItem = new ArtifactItem(new DefaultArtifact("test2", "test2",
"2", null, "jar", "", null));
artifactItem.setIncludes("**/*.xml");
artifactItems.add(artifactItem);
- artifact = stubFactory.createArtifact("test3", "test3", "3");
- artifactItem = new ArtifactItem(artifact);
+
+ artifactItem = new ArtifactItem(new DefaultArtifact("test3", "test3",
"3", null, "jar", "", null));
artifactItem.setExcludes("**/*.class");
artifactItems.add(artifactItem);
- artifact = stubFactory.createArtifact("test4", "test4", "4");
- artifactItem = new ArtifactItem(artifact);
+
+ artifactItem = new ArtifactItem(new DefaultArtifact("test4", "test4",
"4", null, "jar", "", null));
artifactItem.setIncludes("**/*.xml");
artifactItem.setExcludes("**/*.class");
artifactItems.add(artifactItem);
diff --git a/src/test/resources/unit/skip-test/plugin-analyze-report-config.xml
b/src/test/resources/unit/skip-test/plugin-analyze-report-config.xml
deleted file mode 100644
index ac324dd0..00000000
--- a/src/test/resources/unit/skip-test/plugin-analyze-report-config.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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 xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
-
- <groupId>com.mycompany.app</groupId>
- <artifactId>my-mojo</artifactId>
- <packaging>maven-plugin</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>my-mojo Maven Mojo</name>
- <url>http://maven.apache.org</url>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- <outputDirectory>target/unit-tests/skip-test</outputDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/test/resources/unit/skip-test/plugin-config.xml
b/src/test/resources/unit/skip-test/plugin-config.xml
deleted file mode 100644
index 0006e272..00000000
--- a/src/test/resources/unit/skip-test/plugin-config.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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 xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
-
- <groupId>com.mycompany.app</groupId>
- <artifactId>my-mojo</artifactId>
- <packaging>maven-plugin</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>my-mojo Maven Mojo</name>
- <url>http://maven.apache.org</url>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/test/resources/unit/skip-test/plugin-get-config.xml
b/src/test/resources/unit/skip-test/plugin-get-config.xml
deleted file mode 100644
index 0006e272..00000000
--- a/src/test/resources/unit/skip-test/plugin-get-config.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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 xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
-
- <groupId>com.mycompany.app</groupId>
- <artifactId>my-mojo</artifactId>
- <packaging>maven-plugin</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>my-mojo Maven Mojo</name>
- <url>http://maven.apache.org</url>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/src/test/resources/unit/skip-test/plugin-purge-local-repository-config.xml
b/src/test/resources/unit/skip-test/plugin-purge-local-repository-config.xml
deleted file mode 100644
index 0006e272..00000000
--- a/src/test/resources/unit/skip-test/plugin-purge-local-repository-config.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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 xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
-
- <groupId>com.mycompany.app</groupId>
- <artifactId>my-mojo</artifactId>
- <packaging>maven-plugin</packaging>
- <version>1.0-SNAPSHOT</version>
-
- <name>my-mojo Maven Mojo</name>
- <url>http://maven.apache.org</url>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>