### Question:
SakuliPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { protected void modifySahiProperties(Properties props) { if (writePropertiesToSahiConfig) { String sahiConfigFolderPath = resolve(props.getProperty(SahiProxyProperties.PROXY_CONFIG_FOLDER), props); String sahiPropConfig = Paths.get(sahiConfigFolderPath + SahiProxyProperties.SAHI_PROPERTY_FILE_APPENDER).normalize().toAbsolutePath().toString(); modifyPropertiesConfiguration(sahiPropConfig, SahiProxyProperties.userdataPropertyNames, props); modifySahiProxyPortPropertiesConfiguration(sahiPropConfig, props); String sahiLogPropConfig = Paths.get(sahiConfigFolderPath + SahiProxyProperties.SAHI_LOG_PROPERTY_FILE_APPENDER).normalize().toAbsolutePath().toString(); modifyPropertiesConfiguration(sahiLogPropConfig, SahiProxyProperties.logPropertyNames, props); } } SakuliPropertyPlaceholderConfigurer(); static void assignEncryptionProperties(Properties props); Properties getPropsRef(); @PreDestroy void restoreProperties(); boolean isLoadSakuliDefaultProperties(); void setLoadSakuliDefaultProperties(boolean loadSakuliDefaultProperties); boolean isLoadSakuliProperties(); void setLoadSakuliProperties(boolean loadSakuliProperties); boolean isLoadTestSuiteProperties(); void setLoadTestSuiteProperties(boolean loadTestSuiteProperties); boolean isWritePropertiesToSahiConfig(); void setWritePropertiesToSahiConfig(boolean writePropertiesToSahiConfig); static String ENCRYPTION_KEY_VALUE; static String TEST_SUITE_FOLDER_VALUE; static String SAKULI_HOME_FOLDER_VALUE; static String SAHI_HOME_VALUE; static String TEST_SUITE_BROWSER; static String ENCRYPTION_INTERFACE_VALUE; }### Answer:
@SuppressWarnings("unchecked") @Test public void testModifySahiProperties() throws Exception { Properties props = new Properties(); doNothing().when(testling).modifyPropertiesConfiguration(anyString(), anyListOf(String.class), any(Properties.class)); testling.setWritePropertiesToSahiConfig(true); testling.modifySahiProperties(props); ArgumentCaptor<List> argumentCaptorSahiProp = ArgumentCaptor.forClass(List.class); ArgumentCaptor<List> argumentCaptorLogProp = ArgumentCaptor.forClass(List.class); verify(testling).modifyPropertiesConfiguration(contains(SahiProxyProperties.SAHI_PROPERTY_FILE_APPENDER), argumentCaptorSahiProp.capture(), eq(props)); verify(testling).modifyPropertiesConfiguration(contains(SahiProxyProperties.SAHI_LOG_PROPERTY_FILE_APPENDER), argumentCaptorLogProp.capture(), eq(props)); assertTrue(argumentCaptorSahiProp.getValue().containsAll( Arrays.asList("logs.dir", "ext.http.proxy.enable", "ext.http.proxy.host", "ext.http.proxy.port", "ext.http.proxy.auth.enable", "ext.http.proxy.auth.name", "ext.http.proxy.auth.password", "ext.https.proxy.enable", "ext.https.proxy.host", "ext.https.proxy.port", "ext.https.proxy.auth.enable", "ext.https.proxy.auth.name", "ext.https.proxy.auth.password", "ext.http.both.proxy.bypass_hosts", "ssl.client.keystore.type", "ssl.client.cert.path", "ssl.client.cert.password")), "currently contains: " + argumentCaptorSahiProp.getValue().toString()); assertTrue(argumentCaptorLogProp.getValue().containsAll( Arrays.asList("handlers", "java.util.logging.ConsoleHandler.level", "java.util.logging.FileHandler.level", "java.util.logging.ConsoleHandler.formatter", "java.util.logging.FileHandler.formatter", "java.util.logging.FileHandler.limit", "java.util.logging.FileHandler.count", "java.util.logging.FileHandler.pattern")), "currently contains: " + argumentCaptorLogProp.getValue().toString()); }