@Test
public void createsSecret() throws Exception {

  when(secretController.getSecretById(secret.getId())).thenReturn(Optional.of(secret));
  SecretController.SecretBuilder secretBuilder = mock(SecretController.SecretBuilder.class);
  when(secretController.builder(secret.getName(), secret.getSecret(), user.getName(), 0))
      .thenReturn(secretBuilder);
  when(secretBuilder.create()).thenReturn(secret);
  CreateSecretRequestV2 req =
      CreateSecretRequestV2.builder()
          .name(secret.getName())
          .description(secret.getDescription())
          .content(secret.getSecret())
          .build();
  Response response = resource.createSecret(user, req);
  assertThat(response.getStatus()).isEqualTo(201);
  assertThat(response.getMetadata().get(HttpHeaders.LOCATION))
      .containsExactly(new URI("/admin/secrets/" + secret.getId()));
}