GlacierUploaderOptionParser extends OptionParser { public List<File> mergeNonOptionsFiles(List<File> optionsFiles, List<String> nonOptions) { final List<File> files = new ArrayList<>(optionsFiles); if (!nonOptions.isEmpty()) { for (String nonOption : nonOptions) { File file = new File(nonOption); if (file.exists() && file.isFile()) { files.add(file); } } } return files; } GlacierUploaderOptionParser(final Configuration config); String parseEndpointToRegion(String endpointOptionValue); List<File> mergeNonOptionsFiles(List<File> optionsFiles, List<String> nonOptions); final OptionSpec<Void> listVaults; final OptionSpec<Void> listJobs; final OptionSpec<File> targetFile; @Deprecated
    final OptionSpec<String> endpoint; final OptionSpec<String> region; final OptionSpec<String> vault; final OptionSpec<File> upload; final OptionSpec<String> download; final OptionSpec<String> inventoryListing; final OptionSpec<Void> createVault; @Deprecated
    final OptionSpec<File> credentials; final OptionSpec<String> deleteArchive; final OptionSpec<Void> deleteVault; final OptionSpec<File> calculateHash; final OptionSpec<File> multipartUpload; final OptionSpec<Long> partSize; final OptionSpec<Void> help; final OptionSpec<String> abortUpload; }
@Test public void parsesFilesWithWhitespaceSuccessfully() throws IOException { File tempFile = File.createTempFile("this is a test with whitespaces", ".txt"); tempFile.deleteOnExit(); System.out.println("Using temp file: " + tempFile.getAbsolutePath()); final CompositeConfiguration dummyConfig = new CompositeConfiguration(); final OptionSet options = optionsParser.parse("-m", tempFile.getAbsolutePath()); final List<File> optionsFiles = options.valuesOf(optionsParser.multipartUpload); final List<String> nonOptions = options.nonOptionArguments(); Assert.assertEquals(1, optionsFiles.size()); Assert.assertEquals(0, nonOptions.size()); final List<File> files = optionsParser.mergeNonOptionsFiles(optionsFiles, nonOptions); Assert.assertEquals(tempFile.getName(), files.get(0).getName()); }