### Question:
DefaultXmlPluginLoader implements CodePluginManager { public CodePluginConfig loadPluginLib(Path directoryPath) { logger.log(System.Logger.Level.INFO, "Loading plugins in directory " + directoryPath); try { var pluginConfigFile = directoryPath.resolve("tcmenu-plugin.xml"); byte[] dataToLoad = Files.readAllBytes(pluginConfigFile); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = null; dBuilder = factory.newDocumentBuilder(); ByteArrayInputStream in = new ByteArrayInputStream(dataToLoad); Document doc = dBuilder.parse(in); var root = doc.getDocumentElement(); var shortName = root.getAttribute("shortName"); var detailElem = elementWithName(root, "GeneralDetails"); var pluginsElem = elementWithName(root, "Plugins"); if (detailElem == null || pluginsElem == null) { logger.log(ERROR, "GeneralDetails or Plugins elements missing, not loading: " + directoryPath); return null; } List<CodePluginItem> items = new ArrayList<>(); CodePluginConfig config = new CodePluginConfig(); config.setPath(directoryPath); config.setPlugins(transformElements(root, "Plugins", "Plugin", (ele) -> { try { var pluginName = ele.getTextContent().trim(); logger.log(System.Logger.Level.INFO, "Loading plugin item " + pluginName); var path = directoryPath.resolve(pluginName); String strPlugin = null; strPlugin = new String(Files.readAllBytes(path)); var created = loadPlugin(strPlugin); if (created != null) { logger.log(System.Logger.Level.INFO, "Loaded item " + pluginName); created.setConfig(config); return created; } else { logger.log(WARNING, "Failed loading " + pluginName); return null; } } catch (IOException e) { logger.log(ERROR, "Exception while loading plugin", e); return null; } })); config.setModuleName(shortName); config.setName(textOfElementByName(detailElem, "Name")); var licenseField = elementWithName(detailElem, "License"); if (licenseField != null) { config.setLicense(licenseField.getAttribute("name")); config.setLicenseUrl(licenseField.getAttribute("url")); } var vendorField = elementWithName(detailElem, "Author"); if (vendorField != null) { config.setVendor(vendorField.getAttribute("name")); config.setVendorUrl(vendorField.getAttribute("url")); } config.setVersion(textOfElementByName(detailElem, "Version")); return config; } catch (Exception e) { logger.log(ERROR, "Did not fully load library because of error in " + directoryPath, e); return null; } } DefaultXmlPluginLoader(EmbeddedPlatforms embeddedPlatforms, ConfigurationStorage storage); @Override void loadPlugins(List<Path> sourceDirs); @Override void reload(); List<String> getLoadErrrors(); @Override List<CodePluginConfig> getLoadedPlugins(); @Override Optional<Image> getImageForName(CodePluginItem item, String imageName); @Override List<CodePluginItem> getPluginsThatMatch(EmbeddedPlatform platform, SubSystem subSystem); CodePluginConfig loadPluginLib(Path directoryPath); CodePluginItem loadPlugin(String dataToLoad);  }### Answer:
@Test void testLoadingALibrary() throws IOException { var pluginDir = makeStandardPluginInPath(dir); var config = loader.loadPluginLib(pluginDir); assertEquals("unitTest", config.getModuleName()); assertEquals("1.3.5", config.getVersion()); assertEquals("http: assertEquals("Apache 2.0", config.getLicense()); assertEquals("Unit Test Inc", config.getVendor()); assertEquals("http: assertEquals("Super unit test plugin library", config.getName()); assertEquals(2, config.getPlugins().size()); assertEquals("20409bb8-b8a1-4d1d-b632-2cf9b57353e3", config.getPlugins().get(0).getId()); assertEquals("20409bb8-b8a1-4d1d-b632-2cf9b5739888", config.getPlugins().get(1).getId()); assertEquals(config, config.getPlugins().get(0).getConfig()); assertEquals(config, config.getPlugins().get(1).getConfig()); }