DeleteVaultCommand extends AbstractCommand { @Override public void exec(OptionSet options, GlacierUploaderOptionParser optionParser) { String vaultName = options.valueOf(optionParser.vault); this.deleteVault(vaultName); } DeleteVaultCommand(AmazonGlacier client, AmazonSQS sqs, AmazonSNS sns); @Override void exec(OptionSet options, GlacierUploaderOptionParser optionParser); @Override boolean valid(OptionSet options, GlacierUploaderOptionParser optionParser);  }
@Test public void exec() throws Exception { final String vaultName = "dummyVaultName"; final String archiveId = UUID.randomUUID().toString(); final Capture<DeleteVaultRequest> capturedRequest = newCapture(); expect(client.deleteVault(capture(capturedRequest))).andReturn(new DeleteVaultResult()).times(1); replay(client); final OptionSet options = optionParser.parse("--vault", vaultName, "--delete-vault"); final DeleteVaultCommand command = new DeleteVaultCommand(client, sqs, sns); assertTrue(command.valid(options, optionParser)); command.exec(options, optionParser); verify(client); assertEquals(vaultName, capturedRequest.getValue().getVaultName()); }