@Test
public void mapUuidsToKeys_whenKeyCreationIsDisabled_AndNoKeyIsEverCreated_ThrowsAnException() throws Exception {

  when(encryptionKeysConfiguration.isKeyCreationEnabled()).thenReturn(false);
  when(encryptionKeysConfiguration.getProviders().get(0).getKeys()).thenReturn(asList(activeKeyData));
  when(encryptionKeysConfiguration.getProviders()).thenReturn(asList(activeProvider));
  when(encryptionKeyCanaryDataService.findAll()).thenReturn(newArrayList());
  subject = new EncryptionKeyCanaryMapper(encryptionKeyCanaryDataService,
    encryptionKeysConfiguration, timedRetry, providerFactory);
  exception.expectMessage("Timed out waiting for active key canary to be created");
  subject.mapUuidsToKeys(keySet);
}