### Question:
Config { static KeyStoreOptions createKeyStoreOptions(final Properties properties) { val keyStorePath = getProperty(properties, "keyStorePath"); val keyStorePass = getProperty(properties, "keyStorePass"); val keyPass = getProperty(properties, "keyPass"); val trustStorePath = getProperty(properties, "trustStorePath"); val trustStorePass = getProperty(properties, "trustStorePass"); val keyAlias = properties.getProperty("keyAlias", null); val spiffeSocketPath = properties.getProperty("spiffeSocketPath", null); val keyStoreTypeProp = properties.getProperty("keyStoreType", null); KeyStoreType keyStoreType; if (StringUtils.isNotBlank(keyStoreTypeProp)) { keyStoreType = KeyStoreType.parse(keyStoreTypeProp); } else { keyStoreType = KeyStoreType.getDefaultType(); } return KeyStoreOptions.builder() .keyStorePath(Paths.get(keyStorePath)) .keyStorePass(keyStorePass) .keyPass(keyPass) .trustStorePath(Paths.get(trustStorePath)) .trustStorePass(trustStorePass) .keyAlias(keyAlias) .spiffeSocketPath(spiffeSocketPath) .keyStoreType(keyStoreType) .build(); } private  Config();   }### Answer:
@Test void createKeyStoreOptions() throws URISyntaxException { Properties configuration = getValidConfiguration(); KeyStoreHelper.KeyStoreOptions keyStoreOptions = Config.createKeyStoreOptions(configuration); assertEquals("keystore123.p12", keyStoreOptions.getKeyStorePath().toString()); assertEquals("example123", keyStoreOptions.getKeyStorePass()); assertEquals("pass123", keyStoreOptions.getKeyPass()); assertEquals("truststore123.p12", keyStoreOptions.getTrustStorePath().toString()); assertEquals("otherpass123", keyStoreOptions.getTrustStorePass()); assertEquals("jks", keyStoreOptions.getKeyStoreType().value()); assertEquals("other_alias", keyStoreOptions.getKeyAlias()); assertEquals("unix:/tmp/test", keyStoreOptions.getSpiffeSocketPath()); }
@Test void createKeyStoreOptions_aRequiredProperty_is_missing() throws URISyntaxException { Properties configuration = getValidConfiguration(); configuration.setProperty("trustStorePass", ""); try { Config.createKeyStoreOptions(configuration); fail(); } catch (Exception e) { assertEquals("Missing value for config property: trustStorePass", e.getMessage()); } }
@Test void createKeyStoreOptions_keyStoreTypeMissing_useDefault() throws URISyntaxException { Properties configuration = getValidConfiguration(); configuration.setProperty("keyStoreType", ""); KeyStoreHelper.KeyStoreOptions keyStoreOptions = Config.createKeyStoreOptions(configuration); assertEquals(KeyStoreType.getDefaultType(), keyStoreOptions.getKeyStoreType()); }