@Test
public void addSecret() {

  CreateSecretRequest request = new CreateSecretRequest("mySecret",
      "some secret",
      "ponies",
      null,
      0);
  Secret secret = new Secret(0, /* Set by DB */
      request.name,
      request.description,
      () -> Base64.getUrlEncoder().encodeToString(request.content.getBytes(UTF_8)),
      "checksum",
      NOW,
      automation.getName(),
      NOW, /* updatedAt set by DB */
      automation.getName(),
      request.metadata,
      null,
      null,
      0,
      1L,
      NOW,
      automation.getName());
  when(secretBuilder.create()).thenReturn(secret);
  when(secretController.getSecretByName(eq(request.name)))
      .thenReturn(Optional.of(secret));
  AutomationSecretResponse response = resource.createSecret(automation, request);
  assertThat(response.id()).isEqualTo(secret.getId());
  assertThat(response.secret()).isEqualTo(secret.getSecret());
  assertThat(response.name()).isEqualTo(secret.getDisplayName());
  assertThat(response.metadata()).isEqualTo(secret.getMetadata());
}