### Question:
XmlDescriptorParser implements DescriptorParser { public int getPluginsVersion() { String val = getPluginElement().attributeValue("pluginsVersion"); if (val == null) { val = getPluginElement().attributeValue("plugins-version"); } if (val != null) { try { return Integer.parseInt(val); } catch (final NumberFormatException e) { throw new RuntimeException("Could not parse pluginsVersion: " + e.getMessage(), e); } } else { return 1; } } XmlDescriptorParser(final Document source, final String... applicationKeys);  XmlDescriptorParser(final InputStream source, final String... applicationKeys); Plugin configurePlugin(final ModuleDescriptorFactory moduleDescriptorFactory, final Plugin plugin); String getKey(); int getPluginsVersion(); PluginInformation getPluginInformation(); boolean isSystemPlugin();  }### Answer:
@Test public void testPluginsVersion() { String xml = "<maera-plugin key=\"foo\" pluginsVersion=\"2\" />"; XmlDescriptorParser parser = new XmlDescriptorParser(new ByteArrayInputStream(xml.getBytes())); assertEquals(2, parser.getPluginsVersion()); }
@Test public void testPluginsVersionMissing() { String xml = "<maera-plugin key=\"foo\" />"; XmlDescriptorParser parser = new XmlDescriptorParser(new ByteArrayInputStream(xml.getBytes())); assertEquals(1, parser.getPluginsVersion()); }
@Test public void testPluginsVersionWithDash() { String xml = "<maera-plugin key=\"foo\" plugins-version=\"2\" />"; XmlDescriptorParser parser = new XmlDescriptorParser(new ByteArrayInputStream(xml.getBytes())); assertEquals(2, parser.getPluginsVersion()); }