@Before public void setUp() { MockitoAnnotations.initMocks(this); given(this.resolver.getGroupId("spring-boot-starter-logging")) .willReturn("org.springframework.boot"); given(this.resolver.getArtifactId("spring-boot-starter-logging")) .willReturn("spring-boot-starter-logging"); this.moduleNode.addClass(this.classNode); this.dependencyCustomizer = new DependencyCustomizer( new GroovyClassLoader(getClass().getClassLoader()), this.moduleNode, new DependencyResolutionContext() { @Override public ArtifactCoordinatesResolver getArtifactCoordinatesResolver() { return DependencyCustomizerTests.this.resolver; } }); }
/** * Add a single dependency with the specified classifier and type and, optionally, all * of its dependencies. The group ID and version of the dependency are resolved from * the module by using the customizer's {@link ArtifactCoordinatesResolver}. * @param module The module ID * @param classifier The classifier, may be {@code null} * @param type The type, may be {@code null} * @param transitive {@code true} if the transitive dependencies should also be added, * otherwise {@code false}. * @return this {@link DependencyCustomizer} for continued use */ public DependencyCustomizer add(String module, String classifier, String type, boolean transitive) { if (canAdd()) { ArtifactCoordinatesResolver artifactCoordinatesResolver = this.dependencyResolutionContext .getArtifactCoordinatesResolver(); this.classNode.addAnnotation( createGrabAnnotation(artifactCoordinatesResolver.getGroupId(module), artifactCoordinatesResolver.getArtifactId(module), artifactCoordinatesResolver.getVersion(module), classifier, type, transitive)); } return this; }
public ArtifactCoordinatesResolver getArtifactCoordinatesResolver() { return this.artifactCoordinatesResolver; }
@Override public ArtifactCoordinatesResolver getArtifactCoordinatesResolver() { return ResolveDependencyCoordinatesTransformationTests.this.coordinatesResolver; }