Search in sources :

Example 6 with Dependency

use of org.eclipse.jkube.kit.common.Dependency in project jkube by eclipse.

the class MavenUtilTest method testGetTransitiveDependencies.

@Test
public void testGetTransitiveDependencies(@Mocked MavenProject mavenProject) {
    // Given
    final Artifact artifact1 = new DefaultArtifact("org.eclipse.jkube", "foo-dependency", "1.33.7", "runtime", "jar", "", new DefaultArtifactHandler("jar"));
    final Artifact artifact2 = new DefaultArtifact("org.eclipse.jkube", "bar-dependency", "1.33.7", "runtime", "jar", "", new DefaultArtifactHandler("jar"));
    new Expectations() {

        {
            mavenProject.getArtifacts();
            result = new HashSet<>(Arrays.asList(artifact1, artifact2));
        }
    };
    // When
    final List<Dependency> result = MavenUtil.getTransitiveDependencies(mavenProject);
    // Then
    assertThat(result).hasSize(2).contains(Dependency.builder().groupId("org.eclipse.jkube").artifactId("foo-dependency").version("1.33.7").type("jar").scope("runtime").build(), Dependency.builder().groupId("org.eclipse.jkube").artifactId("bar-dependency").version("1.33.7").type("jar").scope("runtime").build());
}
Also used : Expectations(mockit.Expectations) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) Dependency(org.eclipse.jkube.kit.common.Dependency) Artifact(org.apache.maven.artifact.Artifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) Test(org.junit.Test)

Aggregations

Dependency (org.eclipse.jkube.kit.common.Dependency)6 File (java.io.File)3 Expectations (mockit.Expectations)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Properties (java.util.Properties)1 Set (java.util.Set)1 Function (java.util.function.Function)1