@Test
public void addWithMetadata() throws Exception {

  addActionConfig.addType = Arrays.asList("secret");
  addActionConfig.name = secret.getDisplayName();
  addActionConfig.json = "{\"owner\":\"example-name\", \"group\":\"example-group\"}";
  byte[] content = base64Decoder.decode(secret.getSecret());
  addAction.stream = new ByteArrayInputStream(content);
  when(keywhizClient.getSanitizedSecretByName(secret.getName()))
      .thenThrow(new NotFoundException()); // Call checks for existence.
  ImmutableMap<String, String> expected =
      ImmutableMap.of("owner", "example-name", "group", "example-group");
  when(keywhizClient.createSecret(secret.getName(), "", content, expected, 0))
      .thenReturn(secretDetailResponse);
  addAction.run();
  verify(keywhizClient, times(1)).createSecret(secret.getName(), "", content, expected, 0);
}