@Test public void returnsJsonArrayWhenUserHasOneSecret() throws Exception { when(aclDAO.getSanitizedSecretsFor(client)).thenReturn(ImmutableSet.of(sanitizedFirstSecret)); List<SecretDeliveryResponse> secrets = secretsDeliveryResource.getSecrets(client); assertThat(secrets).containsOnly(SecretDeliveryResponse.fromSanitizedSecret( SanitizedSecret.fromSecret(firstSecret))); }
@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);  }