1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.artifact.factory;
20
21 import javax.inject.Inject;
22
23 import org.apache.maven.artifact.Artifact;
24 import org.apache.maven.artifact.versioning.VersionRange;
25 import org.codehaus.plexus.testing.PlexusTest;
26 import org.junit.jupiter.api.Test;
27
28 import static org.junit.jupiter.api.Assertions.assertEquals;
29
30 @PlexusTest
31 @Deprecated
32 class DefaultArtifactFactoryTest {
33
34 @Inject
35 ArtifactFactory factory;
36
37 @Test
38 void testPropagationOfSystemScopeRegardlessOfInheritedScope() {
39 Artifact artifact = factory.createDependencyArtifact(
40 "test-grp", "test-artifact", VersionRange.createFromVersion("1.0"), "type", null, "system", "provided");
41 Artifact artifact2 = factory.createDependencyArtifact(
42 "test-grp", "test-artifact-2", VersionRange.createFromVersion("1.0"), "type", null, "system", "test");
43 Artifact artifact3 = factory.createDependencyArtifact(
44 "test-grp",
45 "test-artifact-3",
46 VersionRange.createFromVersion("1.0"),
47 "type",
48 null,
49 "system",
50 "runtime");
51 Artifact artifact4 = factory.createDependencyArtifact(
52 "test-grp",
53 "test-artifact-4",
54 VersionRange.createFromVersion("1.0"),
55 "type",
56 null,
57 "system",
58 "compile");
59
60
61 Artifact artifact5 = factory.createDependencyArtifact(
62 "test-grp", "test-artifact-5", VersionRange.createFromVersion("1.0"), "type", null, "system", "system");
63
64 assertEquals("system", artifact.getScope());
65 assertEquals("system", artifact2.getScope());
66 assertEquals("system", artifact3.getScope());
67 assertEquals("system", artifact4.getScope());
68 assertEquals("system", artifact5.getScope());
69 }
70 }