DefaultMetadataProvider implements MetadataProvider { @Override public PluginMetadata getMetadata() { final String name = pluginDescriptorName; final String version = readVersion(); return new SimplePluginMetadata(name, version); } DefaultMetadataProvider(final String pluginDescriptorName); @Override PluginMetadata getMetadata();  }
@Test public void testMetadataProvider() { final String pluginDescriptorName = getClass().getName(); final MetadataProvider provider = new DefaultMetadataProvider(pluginDescriptorName); final PluginMetadata metadata = provider.getMetadata(); assertThat(metadata).isNotNull(); assertThat(metadata.getName()).isNotNull(); assertThat(metadata.getName()).isNotEmpty(); assertThat(metadata.getVersion()).isNotNull(); assertThat(metadata.getName()).isEqualTo(pluginDescriptorName); assertThat(metadata.getVersion()).isNotEmpty(); assertThat(metadata.getVersion()).isEqualTo("1.2.3"); System.out.println(metadata.toString()); }
@Test public void testMetadataProviderNotFound() { final String pluginDescriptorName = "NotFound"; final MetadataProvider provider = new DefaultMetadataProvider(pluginDescriptorName); final PluginMetadata metadata = provider.getMetadata(); assertThat(metadata).isNotNull(); assertThat(metadata.getName()).isNotNull(); assertThat(metadata.getName()).isNotEmpty(); assertThat(metadata.getVersion()).isNotNull(); assertThat(metadata.getName()).isEqualTo(pluginDescriptorName); assertThat(metadata.getVersion()).isNotEmpty(); assertThat(metadata.getVersion()).isEqualTo("UNDEFINED"); System.out.println(metadata.toString()); }