Skip to content

Commit

Permalink
Fixed CleanMojoTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Bukama authored and slawekjaranowski committed Apr 4, 2024
1 parent c21ec13 commit 1e87ea3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/test/java/org/apache/maven/plugins/clean/CleanMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -273,6 +274,7 @@ public void testCleanLockedFileWithNoError() throws Exception {

/**
* Test the followLink option with windows junctions
*
* @throws Exception
*/
public void testFollowLinksWithWindowsJunction() throws Exception {
Expand All @@ -298,6 +300,7 @@ public void testFollowLinksWithWindowsJunction() throws Exception {

/**
* Test the followLink option with sym link
*
* @throws Exception
*/
public void testFollowLinksWithSymLinkOnPosix() throws Exception {
Expand All @@ -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");
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 1e87ea3

Please sign in to comment.