VaultPrinter { public void printVault(final DescribeVaultOutput output, OutputStream o) { final PrintWriter out = new PrintWriter(o); final String creationDate = output.getCreationDate(); final String lastInventoryDate = output.getLastInventoryDate(); final Long numberOfArchives = output.getNumberOfArchives(); final Long sizeInBytes = output.getSizeInBytes(); final String vaultARN = output.getVaultARN(); final String vaultName = output.getVaultName(); printVault(out, creationDate, lastInventoryDate, numberOfArchives, sizeInBytes, vaultARN, vaultName); }  void printVault(final DescribeVaultOutput output, OutputStream o); void printVault(final DescribeVaultResult output, final OutputStream o);  }
@Test public void testPrintVaultOutput() { final String linebreak = System.getProperty("line.separator"); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final DescribeVaultOutput describeVaultResult = new DescribeVaultOutput(); describeVaultResult.setCreationDate(CREATION_DATE); describeVaultResult.setLastInventoryDate(INVENTORY_DATE); describeVaultResult.setNumberOfArchives(NUMBER_OF_ARCHIVES); describeVaultResult.setSizeInBytes(SIZE_IN_BYTES); describeVaultResult.setVaultARN(ARN); describeVaultResult.setVaultName(VAULT_NAME); new VaultPrinter().printVault(describeVaultResult, out); assertEquals("CreationDate:\t" + CREATION_DATE + linebreak + "LastInventoryDate:\t" + INVENTORY_DATE + linebreak + "NumberOfArchives:\t" + NUMBER_OF_ARCHIVES + linebreak + "SizeInBytes:\t\t" + SIZE_IN_BYTES + linebreak + "VaultARN:\t\t" + ARN + linebreak + "VaultName:\t\t" + VAULT_NAME + linebreak, out.toString()); }
@Test public void testPrintVaultResult() { final String linebreak = System.getProperty("line.separator"); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final DescribeVaultResult describeVaultResult = new DescribeVaultResult(); describeVaultResult.setCreationDate(CREATION_DATE); describeVaultResult.setLastInventoryDate(INVENTORY_DATE); describeVaultResult.setNumberOfArchives(NUMBER_OF_ARCHIVES); describeVaultResult.setSizeInBytes(SIZE_IN_BYTES); describeVaultResult.setVaultARN(ARN); describeVaultResult.setVaultName(VAULT_NAME); new VaultPrinter().printVault(describeVaultResult, out); assertEquals("CreationDate:\t" + CREATION_DATE + linebreak + "LastInventoryDate:\t" + INVENTORY_DATE + linebreak + "NumberOfArchives:\t" + NUMBER_OF_ARCHIVES + linebreak + "SizeInBytes:\t\t" + SIZE_IN_BYTES + linebreak + "VaultARN:\t\t" + ARN + linebreak + "VaultName:\t\t" + VAULT_NAME + linebreak, out.toString()); }