Source:
<code>public FileProvisioning(String configFile) { this.config = Utilities.parseConfig(configFile); this.threads = config.getInt(FileProvisioning.FILE_PROVISION_THREADS, FileProvisioning.DEFAULT_THREADS); this.cache = isCacheOn(config); try { PluginManager pluginManager = FileProvisionUtil.getPluginManager(config); this.plugins = pluginManager.getExtensions(ProvisionInterface.class); this.preProvisionPlugins = pluginManager.getExtensions(PreProvisionInterface.class); this.pluginsMap = this.plugins .stream() <START> .collect(Collectors.toMap(plugin -> plugin.getClass().getName().split("\\$")[0], plugin -> plugin)); <END> this.preProvisionMap = this.preProvisionPlugins .stream() .collect(Collectors.toMap(plugin -> plugin.getClass().getName().split("\\$")[0], plugin -> plugin)); List<PluginWrapper> pluginWrappers = pluginManager.getPlugins(); for (PluginWrapper pluginWrapper : pluginWrappers) { SubnodeConfiguration section = config.getSection(pluginWrapper.getPluginId()); Map<String, String> sectionConfig = new HashMap<>(); Iterator<String> keys = section.getKeys(); keys.forEachRemaining(key -> sectionConfig.put(key, section.getString(key))); String pluginClass = pluginWrapper.getDescriptor().getPluginClass(); if (pluginsMap.containsKey(pluginClass)) { pluginsMap.get(pluginClass).setConfiguration(sectionConfig); } if (preProvisionMap.containsKey(pluginClass)) { preProvisionMap.get(pluginClass).setConfiguration(sectionConfig); } } } catch (UnexpectedCharacterException e) { LOG.error("Could not load plugins: " + e.toString(), e); throw new RuntimeException(e); } }</code><technical_language>create a test for logic. is a test file, FileProvisionTest put tests in</technical_language>

Target:
public FileProvisioning(String configFile) { this.config = Utilities.parseConfig(configFile); this.threads = config.getInt(FileProvisioning.FILE_PROVISION_THREADS, FileProvisioning.DEFAULT_THREADS); this.cache = isCacheOn(config); try { PluginManager pluginManager = FileProvisionUtil.getPluginManager(config); this.plugins = pluginManager.getExtensions(ProvisionInterface.class); this.preProvisionPlugins = pluginManager.getExtensions(PreProvisionInterface.class); this.pluginsMap = this.plugins .stream() .collect(Collectors.toMap(plugin -> findPluginName(plugin.getClass().getName()), plugin -> plugin)); this.preProvisionMap = this.preProvisionPlugins .stream() .collect(Collectors.toMap(plugin -> findPluginName(plugin.getClass().getName()), plugin -> plugin)); List<PluginWrapper> pluginWrappers = pluginManager.getPlugins(); for (PluginWrapper pluginWrapper : pluginWrappers) { SubnodeConfiguration section = config.getSection(pluginWrapper.getPluginId()); Map<String, String> sectionConfig = new HashMap<>(); Iterator<String> keys = section.getKeys(); keys.forEachRemaining(key -> sectionConfig.put(key, section.getString(key))); String pluginClass = pluginWrapper.getDescriptor().getPluginClass(); if (pluginsMap.containsKey(pluginClass)) { pluginsMap.get(pluginClass).setConfiguration(sectionConfig); } if (preProvisionMap.containsKey(pluginClass)) { preProvisionMap.get(pluginClass).setConfiguration(sectionConfig); } } } catch (UnexpectedCharacterException e) { LOG.error("Could not load plugins: " + e.toString(), e); throw new RuntimeException(e); } }