Skip to content

Commit 511adb9

Browse files
Copilotslachiewicz
andcommitted
Address code review feedback - improve test assertion
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
1 parent 934cad3 commit 511adb9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/test/java/org/codehaus/plexus/components/io/resources/PlexusIoFileResourceCollectionSymlinkTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,17 @@ void testFollowSymlinksToDirsDisabled() throws Exception {
7979
collection.setFollowingSymLinks(false);
8080

8181
List<PlexusIoResource> resources = collectResources(collection);
82-
// Should not follow the directory symlink, so fewer or no resources
83-
// The exact behavior depends on DirectoryScanner
84-
assertTrue(resources.size() >= 0);
82+
// When not following symlinks, DirectoryScanner won't traverse into symDir
83+
// so we expect fewer resources than when following
84+
PlexusIoFileResourceCollection followCollection = new PlexusIoFileResourceCollection();
85+
followCollection.setBaseDir(new File("src/test/resources/symlinks/src"));
86+
followCollection.setIncludes(new String[] {"symDir/**"});
87+
followCollection.setFollowingSymLinks(true);
88+
List<PlexusIoResource> followResources = collectResources(followCollection);
89+
90+
assertTrue(
91+
resources.size() < followResources.size(),
92+
"Should have fewer resources when not following directory symlinks");
8593
}
8694

8795
@Test

0 commit comments

Comments
 (0)