summaryrefslogtreecommitdiff
path: root/src/test/java/org/javacs/GotoTest.java
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2017-03-19 13:38:40 -0700
committerGeorge Fraser <george@fivetran.com>2017-03-19 13:38:40 -0700
commit69328dca64e15d6acea74866555de7feb462db5b (patch)
treef4e882432695eacdeb0b32545575c56ad6e6d84e /src/test/java/org/javacs/GotoTest.java
parent139784693f4bef6078fdc58e7ce17a9416e1a6c8 (diff)
downloadjava-language-server-69328dca64e15d6acea74866555de7feb462db5b.zip
Fixed most tests
Diffstat (limited to 'src/test/java/org/javacs/GotoTest.java')
-rw-r--r--src/test/java/org/javacs/GotoTest.java23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/test/java/org/javacs/GotoTest.java b/src/test/java/org/javacs/GotoTest.java
index afda170..66f3820 100644
--- a/src/test/java/org/javacs/GotoTest.java
+++ b/src/test/java/org/javacs/GotoTest.java
@@ -6,20 +6,16 @@ import org.junit.Test;
import java.io.IOException;
import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.file.Paths;
import java.util.List;
import java.util.logging.Logger;
import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.hasItems;
-import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
-public class GotoTest extends Fixtures {
+public class GotoTest {
private static final Logger LOG = Logger.getLogger("main");
private static final String file = "/org/javacs/example/Goto.java";
- private static final URI uri = uri(file);
+ private static final URI uri = FindResource.uri(file);
@Test
public void localVariable() throws IOException {
@@ -68,6 +64,8 @@ public class GotoTest extends Fixtures {
public void staticMethod() throws IOException {
List<? extends Location> suggestions = doGoto(file, 15, 13);
+ System.out.println(suggestions.size());
+
assertThat(suggestions, contains(location(uri, 37, 25, 37, 37)));
}
@@ -124,10 +122,12 @@ public class GotoTest extends Fixtures {
return location;
}
+ private static final JavaLanguageServer server = LanguageServerFixture.getJavaLanguageServer();
+
private List<? extends Location> doGoto(String file, int row, int column) throws IOException {
TextDocumentIdentifier document = new TextDocumentIdentifier();
- document.setUri(uri(file).toString());
+ document.setUri(FindResource.uri(file).toString());
Position position = new Position();
@@ -139,16 +139,7 @@ public class GotoTest extends Fixtures {
p.setTextDocument(document);
p.setPosition(position);
- JavaLanguageServer server = Fixtures.getJavaLanguageServer();
-
return server.gotoDefinition(p);
}
- private static URI uri(String file) {
- try {
- return GotoTest.class.getResource(file).toURI();
- } catch (URISyntaxException e) {
- throw new RuntimeException(e);
- }
- }
}