UploadArchiveCommand extends AbstractCommand { @Override public boolean valid(OptionSet options, GlacierUploaderOptionParser optionParser) { return options.has(optionParser.upload); } UploadArchiveCommand(final AmazonGlacier client, final AmazonSQS sqs, final AmazonSNS sns);  UploadArchiveCommand(final AmazonGlacier client, final AmazonSQS sqs, final AmazonSNS sns, final ArchiveTransferManager atm); void upload(final String vaultName, final File uploadFile); @Override void exec(OptionSet options, GlacierUploaderOptionParser optionParser); @Override boolean valid(OptionSet options, GlacierUploaderOptionParser optionParser); static final ScheduledExecutorService SCHEDULED_POOL; static final int PROGRESS_PRINT_PERIOD; }
@Test public void canValidateOptions() throws IOException { final String content = UUID.randomUUID().toString(); final File file = writeTemporaryFile(content); final ArchiveTransferManager atm = createMock(ArchiveTransferManager.class); final UploadArchiveCommand command = new UploadArchiveCommand(client, sqs, sns, atm); final OptionSet validOptions = optionParser.parse("--vault", "vaultName", "--upload", file.getAbsolutePath()); assertTrue(command.valid(validOptions, optionParser)); final OptionSet invalidOptions = optionParser.parse("--vault", "vaultName"); assertFalse(command.valid(invalidOptions, optionParser)); }