diff options
author | George Fraser <george@fivetran.com> | 2017-10-15 12:55:26 -0700 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2017-10-15 12:55:26 -0700 |
commit | 110a55e59c459d7d7bd06f0c22632b83c7a61202 (patch) | |
tree | 6a841f76636897cc09f5a89e85984d249b445f7b /src/test | |
parent | 400b0bce366aad45e2c8ca0cb418fe5e79786e79 (diff) | |
download | java-language-server-110a55e59c459d7d7bd06f0c22632b83c7a61202.zip |
Make test project a maven project
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/javacs/CompletionsBase.java | 17 | ||||
-rw-r--r-- | src/test/java/org/javacs/IncrementalFileManagerTest.java | 2 | ||||
-rw-r--r-- | src/test/test-project/workspace/pom.xml | 25 | ||||
-rw-r--r-- | src/test/test-project/workspace/target/classes/com/example/.gitignore (renamed from src/test/test-project/workspace/out/com/example/.gitignore) | 0 | ||||
-rw-r--r-- | src/test/test-project/workspace/target/classes/com/example/PackagePrivate.class (renamed from src/test/test-project/workspace/out/com/example/PackagePrivate.class) | bin | 276 -> 276 bytes | |||
-rw-r--r-- | src/test/test-project/workspace/target/classes/com/example/Signatures$RegularInnerClass.class (renamed from src/test/test-project/workspace/out/com/example/Signatures$RegularInnerClass.class) | bin | 392 -> 392 bytes | |||
-rw-r--r-- | src/test/test-project/workspace/target/classes/com/example/Signatures$StaticInnerClass.class (renamed from src/test/test-project/workspace/out/com/example/Signatures$StaticInnerClass.class) | bin | 354 -> 354 bytes | |||
-rw-r--r-- | src/test/test-project/workspace/target/classes/com/example/Signatures.class (renamed from src/test/test-project/workspace/out/com/example/Signatures.class) | bin | 581 -> 581 bytes |
8 files changed, 43 insertions, 1 deletions
diff --git a/src/test/java/org/javacs/CompletionsBase.java b/src/test/java/org/javacs/CompletionsBase.java index 1ff814a..d68bcb6 100644 --- a/src/test/java/org/javacs/CompletionsBase.java +++ b/src/test/java/org/javacs/CompletionsBase.java @@ -2,7 +2,9 @@ package org.javacs; import java.io.IOException; import java.net.URI; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.logging.Logger; @@ -38,6 +40,21 @@ public class CompletionsBase { return items.stream().map(CompletionsBase::itemInsertText).collect(Collectors.toSet()); } + protected Map<String, Integer> insertCount(String file, int row, int column) + throws IOException { + List<? extends CompletionItem> items = items(file, row, column); + Map<String, Integer> result = new HashMap<>(); + + for (CompletionItem each : items) { + String key = itemInsertText(each); + int count = result.getOrDefault(key, 0) + 1; + + result.put(key, count); + } + + return result; + } + static String itemInsertText(CompletionItem i) { String text = i.getInsertText(); diff --git a/src/test/java/org/javacs/IncrementalFileManagerTest.java b/src/test/java/org/javacs/IncrementalFileManagerTest.java index 3954c24..310ccd3 100644 --- a/src/test/java/org/javacs/IncrementalFileManagerTest.java +++ b/src/test/java/org/javacs/IncrementalFileManagerTest.java @@ -20,7 +20,7 @@ public class IncrementalFileManagerTest { JavacTool.create().getStandardFileManager(__ -> {}, null, Charset.defaultCharset()); private IncrementalFileManager test = new IncrementalFileManager(delegate); private File sourcePath = Paths.get("./src/test/test-project/workspace/src").toFile(); - private File classPath = Paths.get("./src/test/test-project/workspace/out").toFile(); + private File classPath = Paths.get("./src/test/test-project/workspace/target/classes").toFile(); @Before public void setPaths() throws IOException { diff --git a/src/test/test-project/workspace/pom.xml b/src/test/test-project/workspace/pom.xml new file mode 100644 index 0000000..5cb48aa --- /dev/null +++ b/src/test/test-project/workspace/pom.xml @@ -0,0 +1,25 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <groupId>com.example</groupId> + <artifactId>example-project</artifactId> + <packaging>jar</packaging> + <version>0.1-SNAPSHOT</version> + + <build> + <plugins> + <!-- Set source 1.8 --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.3</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/src/test/test-project/workspace/out/com/example/.gitignore b/src/test/test-project/workspace/target/classes/com/example/.gitignore index f6afe92..f6afe92 100644 --- a/src/test/test-project/workspace/out/com/example/.gitignore +++ b/src/test/test-project/workspace/target/classes/com/example/.gitignore diff --git a/src/test/test-project/workspace/out/com/example/PackagePrivate.class b/src/test/test-project/workspace/target/classes/com/example/PackagePrivate.class Binary files differindex 5b6de1a..5b6de1a 100644 --- a/src/test/test-project/workspace/out/com/example/PackagePrivate.class +++ b/src/test/test-project/workspace/target/classes/com/example/PackagePrivate.class diff --git a/src/test/test-project/workspace/out/com/example/Signatures$RegularInnerClass.class b/src/test/test-project/workspace/target/classes/com/example/Signatures$RegularInnerClass.class Binary files differindex a8a641e..a8a641e 100644 --- a/src/test/test-project/workspace/out/com/example/Signatures$RegularInnerClass.class +++ b/src/test/test-project/workspace/target/classes/com/example/Signatures$RegularInnerClass.class diff --git a/src/test/test-project/workspace/out/com/example/Signatures$StaticInnerClass.class b/src/test/test-project/workspace/target/classes/com/example/Signatures$StaticInnerClass.class Binary files differindex ff83714..ff83714 100644 --- a/src/test/test-project/workspace/out/com/example/Signatures$StaticInnerClass.class +++ b/src/test/test-project/workspace/target/classes/com/example/Signatures$StaticInnerClass.class diff --git a/src/test/test-project/workspace/out/com/example/Signatures.class b/src/test/test-project/workspace/target/classes/com/example/Signatures.class Binary files differindex ca8ee7e..ca8ee7e 100644 --- a/src/test/test-project/workspace/out/com/example/Signatures.class +++ b/src/test/test-project/workspace/target/classes/com/example/Signatures.class |