@Test(expected = IllegalArgumentException.class)
public void addThrowsIfMetadataHasBadKeys() throws Exception {

  addActionConfig.addType = Arrays.asList("secret");
  addActionConfig.name = secret.getDisplayName();
  addActionConfig.json = "{\"ThisIsABadKey\":\"doh\"}";
  addAction.stream = new ByteArrayInputStream(base64Decoder.decode(secret.getSecret()));
  when(keywhizClient.getSanitizedSecretByName(secret.getName()))
      .thenThrow(new NotFoundException()); // Call checks for existence.
  addAction.run();
}