PluginFQNParser { public ExtendedPluginFQN evaluateFqn(String reference, FileContentProvider fileContentProvider) throws InfrastructureException { JsonNode contentNode; try { String pluginMetaContent = fileContentProvider.fetchContent(reference); contentNode = yamlReader.readTree(pluginMetaContent); } catch (DevfileException | IOException e) { throw new InfrastructureException( format("Plugin reference URL '%s' is invalid.", reference), e); } JsonNode publisher = contentNode.path("publisher"); if (publisher.isMissingNode()) { throw new InfrastructureException(formatMessage(reference, "publisher")); } JsonNode name = contentNode.get("name"); if (name.isMissingNode()) { throw new InfrastructureException(formatMessage(reference, "name")); } JsonNode version = contentNode.get("version"); if (version.isMissingNode()) { throw new InfrastructureException(formatMessage(reference, "version")); } if (!version.isValueNode()) { throw new InfrastructureException( format( "Plugin specified by reference URL '%s' has version field that cannot be parsed to string", reference)); } return new ExtendedPluginFQN( reference, publisher.textValue(), name.textValue(), version.asText()); }  Collection<PluginFQN> parsePlugins(Map<String, String> attributes); ExtendedPluginFQN parsePluginFQN(String plugin); ExtendedPluginFQN evaluateFqn(String reference, FileContentProvider fileContentProvider);  }
@Test(dataProvider = "validPluginReferencesProvider") public void shouldParsePluginOrEditorFromReference( String reference, String pluginYaml, ExtendedPluginFQN expected) throws Exception { when(fileContentProvider.fetchContent(eq(reference))).thenReturn(pluginYaml); ExtendedPluginFQN actual = parser.evaluateFqn(reference, fileContentProvider); assertEquals(actual, expected); }