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 testRegisterProvidedLocalResourcesWithDuplication(@TempDir java.nio.file.Path tempDir)
            throws IOException {
        final File flinkLibDir1 =
                Files.createTempDirectory(tempDir, UUID.randomUUID().toString()).toFile();
        final File flinkLibDir2 =
                Files.createTempDirectory(tempDir, UUID.randomUUID().toString()).toFile();

        generateFilesInDirectory(flinkLibDir1, getLibJars());
        generateFilesInDirectory(flinkLibDir2, getLibJars());

        final FileSystem fileSystem = FileSystem.get(new YarnConfiguration());
        try {
            assertThrows(
                    "Two files with the same filename exist in the shared libs",
                    RuntimeException.class,
                    () ->
                            YarnApplicationFileUploader.from(
                                    fileSystem,
                                    new Path(tempDir.toFile().toURI()),
                                    Arrays.asList(
                                            new Path(flinkLibDir1.toURI()),
                                            new Path(flinkLibDir2.toURI())),
                                    ApplicationId.newInstance(0, 0),
                                    DFSConfigKeys.DFS_REPLICATION_DEFAULT));
        } finally {
            IOUtils.closeQuietly(fileSystem);
        }
    }