@Test
public void mapUuidsToKeys_whenThereAreMultipleKeys_andCanariesForKeysWeDontHave_itShouldNotBeIncluded()
  throws Exception {

  when(encryptionKeysConfiguration.isKeyCreationEnabled()).thenReturn(true);
  when(encryptionKeysConfiguration.getProviders()).thenReturn(asList(activeProvider));
  when(encryptionKeyCanaryDataService.findAll())
    .thenReturn(asArrayList(unknownCanary, activeKeyCanary));
  subject = new EncryptionKeyCanaryMapper(encryptionKeyCanaryDataService,
    encryptionKeysConfiguration, timedRetry, providerFactory);
  subject.mapUuidsToKeys(keySet);
  assertThat(keySet.get(activeCanaryUuid).getKey(), equalTo(activeKey));
  assertThat(keySet.get(unknownCanaryUuid), equalTo(null));
  assertThat(keySet.getActive().getUuid(), equalTo(activeCanaryUuid));
  assertThat(keySet.getInactiveUuids().size(), equalTo(0));
}