### Question:
KeyConfiguration extends ConfigItem { public List<KeyVaultConfig> getKeyVaultConfigs() { if (keyVaultConfigs == null) { return null; } return keyVaultConfigs.stream().map(KeyVaultConfig.class::cast).collect(Collectors.toList()); } KeyConfiguration(
            final Path passwordFile,
            final List<String> passwords,
            final List<KeyData> keyData,
            final AzureKeyVaultConfig azureKeyVaultConfig,
            final HashicorpKeyVaultConfig hashicorpKeyVaultConfig);  KeyConfiguration(); Path getPasswordFile(); List<String> getPasswords(); List<KeyData> getKeyData(); AzureKeyVaultConfig getAzureKeyVaultConfig(); HashicorpKeyVaultConfig getHashicorpKeyVaultConfig(); List<KeyVaultConfig> getKeyVaultConfigs(); Optional<DefaultKeyVaultConfig> getKeyVaultConfig(KeyVaultType type); void setPasswordFile(Path passwordFile); void setPasswords(List<String> passwords); void setKeyData(List<KeyData> keyData); void addKeyVaultConfig(KeyVaultConfig keyVaultConfig); @Valid
    @NotNull
    @Size(min = 1, message = "At least 1 public/private key pair must be provided")
    private List<KeyData> keyData; }### Answer:
@Test public void loadBothKeyVaultConfigsFromConstructor() { AzureKeyVaultConfig azureKeyVaultConfig = new AzureKeyVaultConfig(); HashicorpKeyVaultConfig hashicorpKeyVaultConfig = new HashicorpKeyVaultConfig(); KeyConfiguration keyConfiguration = new KeyConfiguration(null, null, null, azureKeyVaultConfig, hashicorpKeyVaultConfig); List<KeyVaultConfig> result = keyConfiguration.getKeyVaultConfigs(); assertThat(result).hasSize(2); assertThat(result) .flatExtracting(KeyVaultConfig::getKeyVaultType) .containsExactlyInAnyOrder(KeyVaultType.AZURE, KeyVaultType.HASHICORP); }
@Test public void getKeyVaultConfigsReturnNullIfConfigsAreNull() { KeyConfiguration keyConfiguration = new KeyConfiguration(null, null, null, null, null); assertThat(keyConfiguration.getKeyVaultConfigs()).isNull(); }