### Question:
DefaultKeyVaultConfigValidations implements KeyVaultConfigValidations { @Override public Set<ConstraintViolation<?>> validate(KeyConfiguration keyConfiguration, List<ConfigKeyPair> configKeyPairs) { LOGGER.debug("Validating {} {}", keyConfiguration, configKeyPairs); if (keyConfiguration.getKeyVaultConfigs() != null) { Set<ConstraintViolation<?>> vaultConfigViolations = keyConfiguration.getKeyVaultConfigs().stream() .map(validator::validate) .flatMap(Set::stream) .collect(Collectors.toSet()); Set<ConstraintViolation<?>> keyPairViolations = configKeyPairs.stream().map(validator::validate).flatMap(Set::stream).collect(Collectors.toSet()); LOGGER.debug("Validated{} {}", keyConfiguration, configKeyPairs); return Stream.concat(vaultConfigViolations.stream(), keyPairViolations.stream()) .collect(Collectors.toSet()); } LOGGER.debug("Ignore validations no key vaults defined."); return Collections.emptySet(); }  @Override Set<ConstraintViolation<?>> validate(KeyConfiguration keyConfiguration, List<ConfigKeyPair> configKeyPairs);  }### Answer:
@Test public void noKeyVaultConfigsReturnsEmptySet() { KeyConfiguration keyConfiguration = new KeyConfiguration(); Set<ConstraintViolation<?>> results = validator.validate(keyConfiguration, null); assertThat(results).isEmpty(); }
@Test public void validCase() { KeyConfiguration keyConfiguration = mock(KeyConfiguration.class); KeyVaultConfig keyVaultConfig = new DefaultKeyVaultConfig() { { setKeyVaultType(KeyVaultType.AZURE); } }; List<KeyVaultConfig> keyVaultConfigList = Arrays.asList(mock(KeyVaultConfig.class)); when(keyConfiguration.getKeyVaultConfigs()).thenReturn(keyVaultConfigList); ConfigKeyPair keyPair = new AzureVaultKeyPair("publicKeyId", "privateKeyId", null, null); List<ConfigKeyPair> keyPairs = Arrays.asList(keyPair); Set<ConstraintViolation<?>> results = validator.validate(keyConfiguration, keyPairs); assertThat(results).isEmpty(); }