diff --git a/core/src/main/java/io/cucumber/core/resource/PathScanner.java b/core/src/main/java/io/cucumber/core/resource/PathScanner.java index 0d67e1345e..0fa10c5f6b 100644 --- a/core/src/main/java/io/cucumber/core/resource/PathScanner.java +++ b/core/src/main/java/io/cucumber/core/resource/PathScanner.java @@ -6,10 +6,12 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.nio.file.FileVisitOption; import java.nio.file.FileVisitResult; import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; +import java.util.EnumSet; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; @@ -43,7 +45,8 @@ void findResourcesForPath(Path path, Predicate filter, Function resources = resourceScanner.scanForResourcesPath(file.toPath()); + assertThat(resources, contains(file.toURI())); + } + @Test void scanForResourcesDirectory() { File file = new File("src/test/resources/io/cucumber/core/resource"); @@ -112,6 +119,16 @@ void scanForResourcesDirectory() { new File("src/test/resources/io/cucumber/core/resource/test/spaces in name resource.txt").toURI())); } + @Test + void scanForResourcesDirectorySymlink() { + File file = new File("src/test/resource-symlink"); + List resources = resourceScanner.scanForResourcesPath(file.toPath()); + assertThat(resources, containsInAnyOrder( + new File("src/test/resource-symlink/test/resource.txt").toURI(), + new File("src/test/resource-symlink/test/other-resource.txt").toURI(), + new File("src/test/resource-symlink/test/spaces in name resource.txt").toURI())); + } + @Test void scanForResourcesFileUri() { File file = new File("src/test/resources/io/cucumber/core/resource/test/resource.txt"); diff --git a/core/src/test/resource-symlink b/core/src/test/resource-symlink new file mode 120000 index 0000000000..0d9643fced --- /dev/null +++ b/core/src/test/resource-symlink @@ -0,0 +1 @@ +resources/io/cucumber/core/resource \ No newline at end of file