static YarnApplicationFileUploader from(
            final FileSystem fileSystem,
            final Path homeDirectory,
            final List<Path> providedLibDirs,
            final ApplicationId applicationId,
            final int fileReplication)
            throws IOException {
        return new YarnApplicationFileUploader(
                fileSystem, homeDirectory, providedLibDirs, applicationId, fileReplication);
    }
@Test
    void testRegisterProvidedLocalResourcesWithNotAllowedUsrLib(@TempDir File flinkHomeDir)
            throws IOException {
        final File flinkLibDir = new File(flinkHomeDir, "lib");
        final File flinkUsrLibDir = new File(flinkHomeDir, "usrlib");
        final Map<String, String> libJars = getLibJars();
        final Map<String, String> usrLibJars = getUsrLibJars();

        generateFilesInDirectory(flinkLibDir, libJars);
        generateFilesInDirectory(flinkUsrLibDir, usrLibJars);
        final List<Path> providedLibDirs = new ArrayList<>();
        providedLibDirs.add(new Path(flinkLibDir.toURI()));
        providedLibDirs.add(new Path(flinkUsrLibDir.toURI()));

        assertThatThrownBy(
                        () ->
                                YarnApplicationFileUploader.from(
                                        FileSystem.get(new YarnConfiguration()),
                                        new Path(flinkHomeDir.getPath()),
                                        providedLibDirs,
                                        ApplicationId.newInstance(0, 0),
                                        DFSConfigKeys.DFS_REPLICATION_DEFAULT))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessage(
                        "Provided lib directories, configured via %s, should not include %s.",
                        YarnConfigOptions.PROVIDED_LIB_DIRS.key(),
                        ConfigConstants.DEFAULT_FLINK_USR_LIB_DIR);
    }