public static java.nio.file.Path getTargetPathIfContainsSymbolicPath(java.nio.file.Path path)
            throws IOException {
        java.nio.file.Path targetPath = path;
        java.nio.file.Path suffixPath = Paths.get("");
        while (path != null && path.getFileName() != null) {
            if (Files.isSymbolicLink(path)) {
                java.nio.file.Path linkedPath = path.toRealPath();
                targetPath = Paths.get(linkedPath.toString(), suffixPath.toString());
                break;
            }
            suffixPath = Paths.get(path.getFileName().toString(), suffixPath.toString());
            path = path.getParent();
        }
        return targetPath;
    }
@Test
    void testGetTargetPathContainsMultipleSymbolicPath() throws IOException {
        File linked1Dir = TempDirUtils.newFolder(temporaryFolder, "linked1");
        java.nio.file.Path symlink1 = Paths.get(temporaryFolder.toString(), "symlink1");
        Files.createSymbolicLink(symlink1, linked1Dir.toPath());

        java.nio.file.Path symlink2 = Paths.get(symlink1.toString(), "symlink2");
        File linked2Dir = TempDirUtils.newFolder(temporaryFolder, "linked2");
        Files.createSymbolicLink(symlink2, linked2Dir.toPath());
        java.nio.file.Path dirInLinked2 =
                TempDirUtils.newFolder(linked2Dir.toPath(), "one").toPath().toRealPath();

        // symlink3 point to another symbolic link: symlink2
        java.nio.file.Path symlink3 = Paths.get(symlink1.toString(), "symlink3");
        Files.createSymbolicLink(symlink3, symlink2);

        java.nio.file.Path targetPath =
                FileUtils.getTargetPathIfContainsSymbolicPath(
                        // path contains multiple symlink : xxx/symlink1/symlink3/one
                        symlink3.resolve("one"));
        assertThat(targetPath).isEqualTo(dirInLinked2);
    }