@Test public void returnsSecretWhenAllowed() throws Exception {

  Secret secret = new Secret(0, "secret_name", null, () -> "unused_secret", "checksum", NOW, null, NOW, null, null, null,
      null, 0, 1L, NOW, null);
  SanitizedSecret sanitizedSecret = SanitizedSecret.fromSecret(secret);
  String name = sanitizedSecret.name();
  when(aclDAO.getSanitizedSecretFor(client, name))
      .thenReturn(Optional.of(sanitizedSecret));
  when(secretController.getSecretByName(name))
      .thenReturn(Optional.of(secret));
  SecretDeliveryResponse response = secretDeliveryResource.getSecret(sanitizedSecret.name(), client);
  assertThat(response).isEqualTo(SecretDeliveryResponse.fromSecret(secret));
}