public static Optional<Path> getQualifiedRemoteProvidedUsrLib(
            org.apache.flink.configuration.Configuration configuration,
            YarnConfiguration yarnConfiguration)
            throws IOException, IllegalArgumentException {
        String usrlib = configuration.get(YarnConfigOptions.PROVIDED_USRLIB_DIR);
        if (usrlib == null) {
            return Optional.empty();
        }
        final Path qualifiedUsrLibPath =
                FileSystem.get(yarnConfiguration).makeQualified(new Path(usrlib));
        checkArgument(
                isRemotePath(qualifiedUsrLibPath.toString()),
                "The \"%s\" must point to a remote dir "
                        + "which is accessible from all worker nodes.",
                YarnConfigOptions.PROVIDED_USRLIB_DIR.key());
        checkArgument(
                isUsrLibDirectory(FileSystem.get(yarnConfiguration), qualifiedUsrLibPath),
                "The \"%s\" should be named with \"%s\".",
                YarnConfigOptions.PROVIDED_USRLIB_DIR.key(),
                ConfigConstants.DEFAULT_FLINK_USR_LIB_DIR);
        return Optional.of(qualifiedUsrLibPath);
    }
@Test
    void testSharedUsrLibIsNotRemotePathShouldThrowException(@TempDir Path tempDir) {
        final File localLib = new File(tempDir.toAbsolutePath().toString(), "usrlib");
        assertThat(localLib.mkdirs()).isTrue();
        final Configuration flinkConfig = new Configuration();
        flinkConfig.set(YarnConfigOptions.PROVIDED_USRLIB_DIR, localLib.getAbsolutePath());
        assertThatThrownBy(
                        () ->
                                Utils.getQualifiedRemoteProvidedUsrLib(
                                        flinkConfig, new YarnConfiguration()))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessage(
                        "The \"%s\" must point to a remote dir "
                                + "which is accessible from all worker nodes.",
                        YarnConfigOptions.PROVIDED_USRLIB_DIR.key());
    }