summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-01-01 22:33:28 -0800
committerGeorge Fraser <george@fivetran.com>2019-01-01 22:33:28 -0800
commit818574c351f3b7ae50e36ee5fa7dadeff7393429 (patch)
tree7f346c38c42d7e7a8a3d7041b44efe8d5d6e0839 /src/test
parent4ddc36150787f5b9d8f245f5d7466b9ee47519a7 (diff)
downloadjava-language-server-818574c351f3b7ae50e36ee5fa7dadeff7393429.zip
Get jar paths directly from maven
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/javacs/InferConfigTest.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/test/java/org/javacs/InferConfigTest.java b/src/test/java/org/javacs/InferConfigTest.java
index debd6db..d49ebb8 100644
--- a/src/test/java/org/javacs/InferConfigTest.java
+++ b/src/test/java/org/javacs/InferConfigTest.java
@@ -22,6 +22,7 @@ public class InferConfigTest {
Collections.emptySet(),
mavenHome,
Paths.get("nowhere"));
+ private InferConfig thisProject = new InferConfig(Paths.get("."), Set.of());
@Test
public void mavenClassPath() {
@@ -63,24 +64,32 @@ public class InferConfigTest {
@Test
public void dependencyList() {
+ assertThat(InferConfig.mvnDependencies(Paths.get("pom.xml"), "dependency:list"), not(empty()));
+ }
+
+ @Test
+ public void thisProjectClassPath() {
assertThat(
- InferConfig.dependencyList(Paths.get("pom.xml")),
- hasItem(new Artifact("org.hamcrest", "hamcrest-all", "1.3")));
+ thisProject.buildClassPath(),
+ hasItem(hasToString(endsWith(".m2/repository/junit/junit/4.12/junit-4.12.jar"))));
}
@Test
- public void onlyPomXmlClassPath() {
+ public void thisProjectDocPath() {
assertThat(
- onlyPomXml.buildClassPath(),
- contains(mavenHome.resolve("repository/com/external/external-library/1.2/external-library-1.2.jar")));
+ thisProject.buildDocPath(),
+ hasItem(hasToString(endsWith(".m2/repository/junit/junit/4.12/junit-4.12-sources.jar"))));
}
@Test
- public void onlyPomXmlDocPath() {
+ public void parseDependencyLine() {
+ var line =
+ "[INFO] org.openjdk.jmh:jmh-generator-annprocess:jar:1.21:provided:/Users/georgefraser/.m2/repository/org/openjdk/jmh/jmh-generator-annprocess/1.21/jmh-generator-annprocess-1.21.jar";
+ var path = InferConfig.readDependency(line).get();
assertThat(
- onlyPomXml.buildDocPath(),
- contains(
- mavenHome.resolve(
- "repository/com/external/external-library/1.2/external-library-1.2-sources.jar")));
+ path,
+ equalTo(
+ Paths.get(
+ "/Users/georgefraser/.m2/repository/org/openjdk/jmh/jmh-generator-annprocess/1.21/jmh-generator-annprocess-1.21.jar")));
}
}