void () { assumeSymLinkCreationIsSupported(); // Tests the situation where the watch root is a symlink AND REMAPPED by the native file watcher. File realDir = tempDir.newDirectory("real"); File symLink = IoTestUtil.createSymLink(realDir.getPath(), tempDir.getRoot() + "/link"); File mappedDir = new File(tempDir.getRoot(), "mapped"); // Initial symlink map: .../root/link -> .../root/real CanonicalPathMap map = createCanonicalPathMap(singletonList(symLink.getPath()), emptyList()); // REMAP from native file watcher: .../root/mapped -> .../root/real map.addMapping(singletonList(pair(mappedDir.getPath(), realDir.getPath()))); // expected: .../root/mapped/file.txt -> .../root/link/file.txt Collection<String> watchedPaths = map.mapToOriginalWatchRoots(new File(mappedDir, "file.txt").getPath(), true); assertThat(watchedPaths).containsExactly(new File(symLink, "file.txt").getPath()); }