kwin commented on code in PR #110:
URL: 
https://github.com/apache/maven-shared-utils/pull/110#discussion_r1059789495


##########
src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java:
##########
@@ -463,6 +464,43 @@ public void 
copyFileWithNoFiltersAndLastModifiedDateOfZeroAndNoDestination()
         assertFileContent( to, "Hello World!" );
     }
 
+    @Test
+    public void 
copyRelativeSymbolicLinkFileWithNonExistingTargetWithNoFiltersAndNoDestination()
+        throws Exception
+    {
+        write(
+            "target.txt",
+            MODIFIED_YESTERDAY,
+            "Hello World!"
+        );
+        // must be a relative symbolic link to existing target
+        Path from = Files.createSymbolicLink( new File(tempFolder.getRoot(), 
"symLink").toPath(), Paths.get( "target.txt" ) );
+        File to = new File(
+            tempFolder.newFolder( "destDirectory" ),
+            "toSymLink"
+        );
+        // this creates a symlink in a new folder pointing to a non-existing 
relative target "./target.txt"
+        FileUtils.copyFile( from.toFile(), to, null, 
(FileUtils.FilterWrapper[]) null );
+
+        // this should not fail
+    }
+
+    @Test
+    public void 
copySymbolicLinkFileWithNonExistingTargetWithNoFiltersAndNoDestination()
+        throws Exception
+    {
+        // link to non existing target
+        Path from = Files.createSymbolicLink( new File(tempFolder.getRoot(), 
"symLink").toPath(), Paths.get( "non-existing.txt" ) );
+        File to = new File(
+            tempFolder.getRoot(),
+            "toSymLink"
+        );
+        // this creates a symlink in a new folder pointing to a non-existing 
relative target "./target.txt"

Review Comment:
   ```suggestion
           // this creates a symlink in a new folder pointing to a non-existing 
relative target "./non-existing.txt"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to