@Test public void testGradleDependencyGeneration() throws ProviderImplementationException { DependencySynonymFormatter formatter = compatibleDependencyFormatRegistry.getProviderImplementation( NugetLayoutProvider.ALIAS, NugetDependencyFormatter.ALIAS); assertThat(formatter).as("Failed to look up dependency synonym formatter!").isNotNull(); NugetArtifactCoordinates coordinates = new NugetArtifactCoordinates("Org.Carlspring.Strongbox.NuGet.Snippet", "1.0"); String snippet = formatter.getDependencySnippet(coordinates); System.out.println(snippet); assertThat("<dependency id=\"" + coordinates.getId() + "\" version=\"" + coordinates.getVersion() + "\" />\n") .as("Failed to generate dependency!") .isEqualTo(snippet); }
@Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { NugetArtifactCoordinates coordinates = (NugetArtifactCoordinates) artifactCoordinates; String sb = "<dependency id=\"" + coordinates.getId() + "\"" + " version=\"" + coordinates.getVersion() + "\" />\n"; return sb; }
NugetDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { NugetArtifactCoordinates coordinates = (NugetArtifactCoordinates) artifactCoordinates; String sb = "<dependency id=\"" + coordinates.getId() + "\"" + " version=\"" + coordinates.getVersion() + "\" />\n"; return sb; } }
NugetDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { NugetArtifactCoordinates coordinates = (NugetArtifactCoordinates) artifactCoordinates; String sb = "<dependency id=\"" + coordinates.getId() + "\"" + " version=\"" + coordinates.getVersion() + "\" />\n"; return sb; }  }
NugetDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { NugetArtifactCoordinates coordinates = (NugetArtifactCoordinates) artifactCoordinates; String sb = "<dependency id=\"" + coordinates.getId() + "\"" + " version=\"" + coordinates.getVersion() + "\" />\n"; return sb; }  @PostConstruct @Override void register(); @Override String getLayout(); @Override String getFormatAlias(); @Override String getDependencySnippet(ArtifactCoordinates artifactCoordinates); }
NugetDependencyFormatter implements DependencySynonymFormatter { @Override public String getDependencySnippet(ArtifactCoordinates artifactCoordinates) { NugetArtifactCoordinates coordinates = (NugetArtifactCoordinates) artifactCoordinates; String sb = "<dependency id=\"" + coordinates.getId() + "\"" + " version=\"" + coordinates.getVersion() + "\" />\n"; return sb; }  @PostConstruct @Override void register(); @Override String getLayout(); @Override String getFormatAlias(); @Override String getDependencySnippet(ArtifactCoordinates artifactCoordinates); static final String ALIAS; }