From 1e87ea303c7a89cc2b54486caf53cfa7186fb7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20B=C3=BCnger?= Date: Sun, 14 Jan 2024 13:09:03 +0100 Subject: [PATCH] Fixed CleanMojoTest.java --- .../maven/plugins/clean/CleanMojoTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java b/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java index f82e615..aef5ce9 100644 --- a/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java @@ -30,6 +30,7 @@ import java.util.Collections; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.logging.SystemStreamLog; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import static org.apache.commons.io.FileUtils.copyDirectory; @@ -273,6 +274,7 @@ public void testCleanLockedFileWithNoError() throws Exception { /** * Test the followLink option with windows junctions + * * @throws Exception */ public void testFollowLinksWithWindowsJunction() throws Exception { @@ -298,6 +300,7 @@ public void testFollowLinksWithWindowsJunction() throws Exception { /** * Test the followLink option with sym link + * * @throws Exception */ public void testFollowLinksWithSymLinkOnPosix() throws Exception { @@ -315,13 +318,9 @@ public void testFollowLinksWithSymLinkOnPosix() throws Exception { }); } - @FunctionalInterface - interface LinkCreator { - void createLink(Path link, Path target) throws Exception; - } - private void testSymlink(LinkCreator linkCreator) throws Exception { - Cleaner cleaner = new Cleaner(null, null, false, null, null); + // We use the SystemStreamLog() as the AbstractMojo class, because from there the Log is always provided + Cleaner cleaner = new Cleaner(null, new SystemStreamLog(), false, null, null); Path testDir = Paths.get("target/test-classes/unit/test-dir").toAbsolutePath(); Path dirWithLnk = testDir.resolve("dir"); Path orgDir = testDir.resolve("org-dir"); @@ -371,4 +370,9 @@ private boolean checkEmpty(String dir) { File[] files = new File(dir).listFiles(); return files == null || files.length == 0; } + + @FunctionalInterface + interface LinkCreator { + void createLink(Path link, Path target) throws Exception; + } }