@Test
public void shouldHandleTooManyKeysCreated() throws IOException {

  when(serviceAccountKeyManager.serviceAccountExists(anyString())).thenReturn(true);
  final GoogleJsonResponseException resourceExhausted = new GoogleJsonResponseException(
      new HttpResponseException.Builder(429, "RESOURCE_EXHAUSTED", new HttpHeaders()),
      new GoogleJsonError().set("status", "RESOURCE_EXHAUSTED"));
  doThrow(resourceExhausted).when(serviceAccountKeyManager).createJsonKey(any());
  doThrow(resourceExhausted).when(serviceAccountKeyManager).createP12Key(any());
  exception.expect(InvalidExecutionException.class);
  exception.expectMessage(String.format(
      "Maximum number of keys on service account reached: %s. Styx requires 4 keys to operate.",
      SERVICE_ACCOUNT));
  sut.ensureServiceAccountKeySecret(WORKFLOW_ID.toString(), SERVICE_ACCOUNT);
}