@Test public void returnsJsonArrayWhenUserHasMultipleSecrets() throws Exception { when(aclDAO.getSanitizedSecretsFor(client)) .thenReturn(ImmutableSet.of(sanitizedFirstSecret, sanitizedSecondSecret)); List<SecretDeliveryResponse> secrets = secretsDeliveryResource.getSecrets(client); assertThat(secrets).containsOnly( SecretDeliveryResponse.fromSanitizedSecret(SanitizedSecret.fromSecret(firstSecret)), SecretDeliveryResponse.fromSanitizedSecret(SanitizedSecret.fromSecret(secondSecret))); }
@Timed @ExceptionMetered @GET public List<SecretDeliveryResponse> getSecrets(@Auth Client client) { logger.info("Client {} listed available secrets.", client.getName()); return aclDAO.getSanitizedSecretsFor(client).stream() .map(SecretDeliveryResponse::fromSanitizedSecret) .collect(toList()); }
SecretsDeliveryResource { @Timed @ExceptionMetered @GET public List<SecretDeliveryResponse> getSecrets(@Auth Client client) { logger.info("Client {} listed available secrets.", client.getName()); return aclDAO.getSanitizedSecretsFor(client).stream() .map(SecretDeliveryResponse::fromSanitizedSecret) .collect(toList()); } }
SecretsDeliveryResource { @Timed @ExceptionMetered @GET public List<SecretDeliveryResponse> getSecrets(@Auth Client client) { logger.info("Client {} listed available secrets.", client.getName()); return aclDAO.getSanitizedSecretsFor(client).stream() .map(SecretDeliveryResponse::fromSanitizedSecret) .collect(toList()); } @Inject  SecretsDeliveryResource(AclDAOFactory aclDAOFactory); @VisibleForTesting  SecretsDeliveryResource(AclDAO aclDAO); }
SecretsDeliveryResource { @Timed @ExceptionMetered @GET public List<SecretDeliveryResponse> getSecrets(@Auth Client client) { logger.info("Client {} listed available secrets.", client.getName()); return aclDAO.getSanitizedSecretsFor(client).stream() .map(SecretDeliveryResponse::fromSanitizedSecret) .collect(toList()); } @Inject  SecretsDeliveryResource(AclDAOFactory aclDAOFactory); @VisibleForTesting  SecretsDeliveryResource(AclDAO aclDAO); @Timed @ExceptionMetered @GET List<SecretDeliveryResponse> getSecrets(@Auth Client client); }
SecretsDeliveryResource { @Timed @ExceptionMetered @GET public List<SecretDeliveryResponse> getSecrets(@Auth Client client) { logger.info("Client {} listed available secrets.", client.getName()); return aclDAO.getSanitizedSecretsFor(client).stream() .map(SecretDeliveryResponse::fromSanitizedSecret) .collect(toList()); } @Inject  SecretsDeliveryResource(AclDAOFactory aclDAOFactory); @VisibleForTesting  SecretsDeliveryResource(AclDAO aclDAO); @Timed @ExceptionMetered @GET List<SecretDeliveryResponse> getSecrets(@Auth Client client);  }