@Test
public void shouldCreateServiceAccountKeysAndSecret() throws IOException {

  when(serviceAccountKeyManager.serviceAccountExists(SERVICE_ACCOUNT)).thenReturn(true);
  ServiceAccountKey jsonKey = new ServiceAccountKey();
  jsonKey.setName("key.json");
  jsonKey.setPrivateKeyData("json-private-key-data");
  ServiceAccountKey p12Key = new ServiceAccountKey();
  p12Key.setName("key.p12");
  p12Key.setPrivateKeyData("p12-private-key-data");
  when(serviceAccountKeyManager.createJsonKey(any(String.class))).thenReturn(jsonKey);
  when(serviceAccountKeyManager.createP12Key(any(String.class))).thenReturn(p12Key);
  sut.ensureServiceAccountKeySecret(WORKFLOW_ID.toString(), SERVICE_ACCOUNT);
  verify(serviceAccountKeyManager).createJsonKey(SERVICE_ACCOUNT);
  verify(serviceAccountKeyManager).createP12Key(SERVICE_ACCOUNT);
  verify(k8sClient).createSecret(secretCaptor.capture());
  final Secret createdSecret = secretCaptor.getValue();
  assertThat(createdSecret.getMetadata().getAnnotations(), hasEntry("styx-wf-sa", SERVICE_ACCOUNT));
  assertThat(createdSecret.getData(), hasEntry("styx-wf-sa.json", jsonKey.getPrivateKeyData()));
  assertThat(createdSecret.getData(), hasEntry("styx-wf-sa.p12", p12Key.getPrivateKeyData()));
}