public static void prepareFilesForStaging(FileStagingOptions options) {
    List<String> filesToStage = options.getFilesToStage();
    if (filesToStage == null || filesToStage.isEmpty()) {
      filesToStage = detectClassPathResourcesToStage(ReflectHelpers.findClassLoader(), options);
      LOG.info(
          "PipelineOptions.filesToStage was not specified. "
              + "Defaulting to files from the classpath: will stage {} files. "
              + "Enable logging at DEBUG level to see which files will be staged.",
          filesToStage.size());
      LOG.debug("Classpath elements: {}", filesToStage);
    }
    final String tmpJarLocation =
        MoreObjects.firstNonNull(options.getTempLocation(), System.getProperty("java.io.tmpdir"));
    final List<String> resourcesToStage = prepareFilesForStaging(filesToStage, tmpJarLocation);
    options.setFilesToStage(resourcesToStage);
  }
@Test
  public void testFailOnNonExistingPaths() throws IOException {
    String nonexistentFilePath = tmpFolder.getRoot().getPath() + "/nonexistent/file";
    String existingFilePath = tmpFolder.newFile("existingFile").getAbsolutePath();
    List<String> filesToStage = Arrays.asList(nonexistentFilePath, existingFilePath);
    String temporaryLocation = tmpFolder.newFolder().getAbsolutePath();

    assertThrows(
        "To-be-staged file does not exist: ",
        IllegalStateException.class,
        () -> PipelineResources.prepareFilesForStaging(filesToStage, temporaryLocation));
  }