Skip to content

Commit def4b86

Browse files
committed
Added test case for artifact source parse
1 parent 4465a5c commit def4b86

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

shared/src/test/kotlin/org/javacs/kt/MavenArtifactParsingTest.kt

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.javacs.kt
33
import org.hamcrest.Matchers.*
44
import org.javacs.kt.classpath.parseMavenArtifact
55
import org.javacs.kt.classpath.Artifact
6+
import org.javacs.kt.classpath.parseMavenSource
67
import org.junit.Assert.assertThat
78
import org.junit.Test
89

@@ -15,34 +16,51 @@ class MavenArtifactParsingTest {
1516
packaging = "jar",
1617
classifier = "jdk15",
1718
version = "2.4",
18-
scope = "compile"
19+
scope = "compile",
20+
source = false
1921
)))
20-
22+
2123
assertThat(parseMavenArtifact("io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.36.Final:compile"), equalTo(Artifact(
2224
group = "io.netty",
2325
artifact = "netty-transport-native-epoll",
2426
packaging = "jar",
2527
classifier = "linux-x86_64",
2628
version = "4.1.36.Final",
27-
scope = "compile"
29+
scope = "compile",
30+
source = false
2831
)))
29-
32+
3033
assertThat(parseMavenArtifact("org.codehaus.mojo:my-project:1.0"), equalTo(Artifact(
3134
group = "org.codehaus.mojo",
3235
artifact = "my-project",
3336
packaging = null,
3437
classifier = null,
3538
version = "1.0",
36-
scope = null
39+
scope = null,
40+
source = false
3741
)))
38-
42+
3943
assertThat(parseMavenArtifact("io.vertx:vertx-sql-client:test-jar:tests:3.8.0-SNAPSHOT:compile"), equalTo(Artifact(
4044
group = "io.vertx",
4145
artifact = "vertx-sql-client",
4246
packaging = "test-jar",
4347
classifier = "tests",
4448
version = "3.8.0-SNAPSHOT",
45-
scope = "compile"
49+
scope = "compile",
50+
source = false
51+
)))
52+
}
53+
54+
@Test
55+
fun `parse maven sources`() {
56+
assertThat(parseMavenSource("org.springframework.boot:spring-boot-starter:jar:sources:2.4.5"), equalTo(Artifact(
57+
group = "org.springframework.boot",
58+
artifact = "spring-boot-starter",
59+
packaging = "jar",
60+
classifier = null,
61+
version = "2.4.5",
62+
scope = null,
63+
source = true
4664
)))
4765
}
4866
}

0 commit comments

Comments
 (0)