This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch MSHARED-1265 in repository https://gitbox.apache.org/repos/asf/maven-file-management.git
commit 9e182dd89fc8ba162c6bb0ae777936969c433e36 Author: Elliotte Rusty Harold <[email protected]> AuthorDate: Sat Jun 10 07:58:10 2023 -0400 [MSHARED-1265] use JUnit assumptions --- .../model/fileset/util/FileSetUtilsTest.java | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java b/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java index 69dbf3d..6e95211 100644 --- a/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java +++ b/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java @@ -37,6 +37,7 @@ 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.Assumptions.assumeTrue; /** * Test the FileSet @@ -78,11 +79,9 @@ public class FileSetUtilsTest { File directory = setupTestDirectory("testIncludesDontFollowSymlinks"); File subdir = new File(directory, directory.getName()); - if (!createSymlink(directory, subdir)) { - // assume failure to create a sym link is because the system does not support them - // and not because the sym link creation failed. - return; - } + // assume failure to create a sym link is because the system does not support them + // and not because the sym link creation failed. + assumeTrue(createSymlink(directory, subdir)); FileSet set = new FileSet(); set.setDirectory(directory.getPath()); @@ -101,11 +100,9 @@ public class FileSetUtilsTest { File directory = setupTestDirectory("testDeleteDontFollowSymlinks"); File subdir = new File(directory, directory.getName()); - if (!createSymlink(directory, subdir)) { - // assume failure to create a sym link is because the system does not support them - // and not because the sym link creation failed. - return; - } + // assume failure to create a sym link is because the system does not support them + // and not because the sym link creation failed. + assumeTrue(createSymlink(directory, subdir)); FileSet set = new FileSet(); set.setDirectory(directory.getPath()); @@ -149,10 +146,10 @@ public class FileSetUtilsTest { File targetFile = new File(directory, "test.txt"); File linkFile = new File(directory, "symlink"); - if (!createSymlink(targetFile, linkFile)) { - // symlinks apparently not supported, skip test - return; - } + // assume failure to create a sym link is because the system does not support them + // and not because the sym link creation failed. + assumeTrue(createSymlink(targetFile, linkFile)); + targetFile.delete(); FileSet set = new FileSet();
