summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2018-05-24 22:52:37 -0700
committerGeorge Fraser <george@fivetran.com>2018-05-24 22:52:37 -0700
commit13b2d8767bc5a4bff410f11f499b63befdd92742 (patch)
tree3e6921abe65bf138d5df94faa0c79dbbc9b0e650 /src/test
parentc02d5974cd1830266ecfe1e6b6a944e30021d186 (diff)
downloadjava-language-server-13b2d8767bc5a4bff410f11f499b63befdd92742.zip
Fix test compilation
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/javacs/CompletionsBase.java2
-rw-r--r--src/test/java/org/javacs/GotoTest.java2
-rw-r--r--src/test/java/org/javacs/LanguageServerFixture.java2
-rw-r--r--src/test/java/org/javacs/SymbolUnderCursorTest.java24
4 files changed, 20 insertions, 10 deletions
diff --git a/src/test/java/org/javacs/CompletionsBase.java b/src/test/java/org/javacs/CompletionsBase.java
index f575886..7e2629d 100644
--- a/src/test/java/org/javacs/CompletionsBase.java
+++ b/src/test/java/org/javacs/CompletionsBase.java
@@ -84,7 +84,7 @@ public class CompletionsBase {
URI uri = FindResource.uri(file);
TextDocumentPositionParams position =
new TextDocumentPositionParams(
- new TextDocumentIdentifier(uri.toString()), uri.toString(), new Position(row - 1, column - 1));
+ new TextDocumentIdentifier(uri.toString()), new Position(row - 1, column - 1));
try {
return server.getTextDocumentService().completion(position).get().getRight().getItems();
diff --git a/src/test/java/org/javacs/GotoTest.java b/src/test/java/org/javacs/GotoTest.java
index 50fb71a..6a46c6c 100644
--- a/src/test/java/org/javacs/GotoTest.java
+++ b/src/test/java/org/javacs/GotoTest.java
@@ -106,8 +106,6 @@ public class GotoTest {
@Test
public void otherCompiledFile() throws IOException {
- server.compile(other);
-
List<? extends Location> suggestions = doGoto(file, 28, 24);
assertThat(suggestions, contains(hasProperty("uri", equalTo(other.toString()))));
diff --git a/src/test/java/org/javacs/LanguageServerFixture.java b/src/test/java/org/javacs/LanguageServerFixture.java
index 730e750..c449282 100644
--- a/src/test/java/org/javacs/LanguageServerFixture.java
+++ b/src/test/java/org/javacs/LanguageServerFixture.java
@@ -55,8 +55,6 @@ class LanguageServerFixture {
server.initialize(init);
server.installClient(client);
- server.maxItems = 100;
-
return server;
}
diff --git a/src/test/java/org/javacs/SymbolUnderCursorTest.java b/src/test/java/org/javacs/SymbolUnderCursorTest.java
index 8f18b4c..b9d8454 100644
--- a/src/test/java/org/javacs/SymbolUnderCursorTest.java
+++ b/src/test/java/org/javacs/SymbolUnderCursorTest.java
@@ -2,8 +2,11 @@ package org.javacs;
import static org.junit.Assert.assertEquals;
-import java.util.Optional;
-import javax.lang.model.element.Element;
+import java.util.StringJoiner;
+import java.util.concurrent.ExecutionException;
+import org.eclipse.lsp4j.Position;
+import org.eclipse.lsp4j.TextDocumentIdentifier;
+import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.junit.Ignore;
import org.junit.Test;
@@ -80,8 +83,19 @@ public class SymbolUnderCursorTest {
private static final JavaLanguageServer server = LanguageServerFixture.getJavaLanguageServer();
private String symbolAt(String file, int line, int character) {
- Optional<Element> symbol = server.findSymbol(FindResource.uri(file), line, character);
-
- return symbol.map(s -> s.getSimpleName().toString()).orElse(null);
+ TextDocumentPositionParams pos =
+ new TextDocumentPositionParams(
+ new TextDocumentIdentifier(FindResource.uri(file).toString()), new Position(line, character));
+ StringJoiner result = new StringJoiner("\n");
+ try {
+ server.getTextDocumentService()
+ .hover(pos)
+ .get()
+ .getContents()
+ .forEach(hover -> result.add(hover.getRight().getValue()));
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ return result.toString();
}
}