ReceiveArchivesListCommand extends AbstractCommand { @Override public void exec(OptionSet options, GlacierUploaderOptionParser optionParser) { final String vaultName = options.valueOf(optionParser.vault); final String jobId = options.valueOf(optionParser.inventoryListing); this.retrieveInventoryListing(vaultName, jobId); } ReceiveArchivesListCommand(final AmazonGlacier client, final AmazonSQS sqs, final AmazonSNS sns);  ReceiveArchivesListCommand(final AmazonGlacier client, final AmazonSQS sqs, final AmazonSNS sns, final VaultInventoryPrinter vaultInventoryPrinter, final OutputStream out); @Override void exec(OptionSet options, GlacierUploaderOptionParser optionParser); @Override boolean valid(OptionSet options, GlacierUploaderOptionParser optionParser);  }
@Test public void exec() throws Exception { final String content = UUID.randomUUID().toString(); final GetJobOutputResult jobResult = new GetJobOutputResult(); jobResult.setBody(new StringInputStream(content)); expect(client.getJobOutput(isA(GetJobOutputRequest.class))).andReturn(jobResult).times(1); replay(client); final OptionSet options = optionParser.parse("--vault", "vaultName", "--list-inventory", UUID.randomUUID().toString()); final ReceiveArchivesListCommand command = new ReceiveArchivesListCommand(client, sqs, sns, new VaultInventoryPrinter() { @Override public void printInventory(final OutputStream out) throws JSONException { assertEquals(content, getInventory()); } }, System.out); assertTrue(command.valid(options, optionParser)); command.exec(options, optionParser); verify(client); }