@Test public void returnsVersionedSecretWhenAllowed() throws Exception {

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