summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-01-09 00:32:09 -0800
committerGeorge Fraser <george@fivetran.com>2019-01-09 00:32:09 -0800
commit8291ef4a16608fd695b5e8254a9a39489de286fb (patch)
tree8f07309e854b22350ae9e1dd22bb09fed5bb6b15
parent059ef0a29c7b483cbd7fed708e96c56904231135 (diff)
downloadjava-language-server-8291ef4a16608fd695b5e8254a9a39489de286fb.zip
Test robustness
-rw-r--r--src/test/java/org/javacs/JavaCompilerServiceTest.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/test/java/org/javacs/JavaCompilerServiceTest.java b/src/test/java/org/javacs/JavaCompilerServiceTest.java
index 9b6c2ee..f10c078 100644
--- a/src/test/java/org/javacs/JavaCompilerServiceTest.java
+++ b/src/test/java/org/javacs/JavaCompilerServiceTest.java
@@ -11,11 +11,13 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import javax.lang.model.element.Element;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -30,6 +32,11 @@ public class JavaCompilerServiceTest {
return Paths.get("src/test/test-project/simple").normalize();
}
+ @Before
+ public void setWorkspaceRoot() {
+ FileStore.setWorkspaceRoots(Set.of(simpleProjectSrc()));
+ }
+
static String contents(String resourceFile) {
var root = JavaCompilerServiceTest.simpleProjectSrc();
var file = root.resolve(resourceFile);
@@ -248,7 +255,8 @@ public class JavaCompilerServiceTest {
@Test
public void localDoc() {
var uri = resourceUri("LocalMethodDoc.java");
- var method = compiler.compileFocus(uri, 3, 21).methodInvocation().get().activeMethod.get();
+ var invocation = compiler.compileFocus(uri, 3, 21).methodInvocation().get();
+ var method = invocation.activeMethod.get();
var ptr = new Ptr(method);
var file = compiler.docs().find(ptr).get();
var parse = compiler.docs().parse(file);