summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-01-05 18:10:43 -0800
committerGeorge Fraser <george@fivetran.com>2019-01-05 18:10:43 -0800
commit971ed1ba1f170ada4e171c1e72eda77840655f5e (patch)
tree8593b898f6a228b5478734831549686ada48c6fb /src
parent77be470a307ab95b022a1c12c150b892df6751f5 (diff)
downloadjava-language-server-971ed1ba1f170ada4e171c1e72eda77840655f5e.zip
Test cross-package goto
Diffstat (limited to 'src')
-rw-r--r--src/test/java/org/javacs/GotoTest.java14
-rw-r--r--src/test/test-project/workspace/src/org/javacs/example/GotoOtherPackageMethod.java13
-rw-r--r--src/test/test-project/workspace/src/org/javacs/other/ImplementsConsumer.java8
-rw-r--r--src/test/test-project/workspace/src/org/javacs/other/ImplementsRunnable.java6
4 files changed, 41 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/GotoTest.java b/src/test/java/org/javacs/GotoTest.java
index 564071e..6587eca 100644
--- a/src/test/java/org/javacs/GotoTest.java
+++ b/src/test/java/org/javacs/GotoTest.java
@@ -148,6 +148,20 @@ public class GotoTest {
}
@Test
+ public void gotoImplementsRunnable() {
+ String file = "/org/javacs/example/GotoOtherPackageMethod.java";
+
+ assertThat(doGoto(file, 7, 12), hasItem("ImplementsRunnable.java:5"));
+ }
+
+ @Test
+ public void gotoImplementsConsumer() {
+ String file = "/org/javacs/example/GotoOtherPackageMethod.java";
+
+ assertThat(doGoto(file, 11, 12), hasItem("ImplementsConsumer.java:7"));
+ }
+
+ @Test
public void gotoError() {
String file = "/org/javacs/example/GotoError.java";
diff --git a/src/test/test-project/workspace/src/org/javacs/example/GotoOtherPackageMethod.java b/src/test/test-project/workspace/src/org/javacs/example/GotoOtherPackageMethod.java
new file mode 100644
index 0000000..a02818f
--- /dev/null
+++ b/src/test/test-project/workspace/src/org/javacs/example/GotoOtherPackageMethod.java
@@ -0,0 +1,13 @@
+package org.javacs.example;
+
+import java.util.function.Consumer;
+
+class GotoOtherPackageMethod {
+ void gotoRun(Runnable r) {
+ r.run();
+ }
+
+ void gotoAccept(Consumer<String> c) {
+ c.accept("foo");
+ }
+} \ No newline at end of file
diff --git a/src/test/test-project/workspace/src/org/javacs/other/ImplementsConsumer.java b/src/test/test-project/workspace/src/org/javacs/other/ImplementsConsumer.java
new file mode 100644
index 0000000..1e8b907
--- /dev/null
+++ b/src/test/test-project/workspace/src/org/javacs/other/ImplementsConsumer.java
@@ -0,0 +1,8 @@
+package org.javacs.other;
+
+import java.util.function.Consumer;
+
+class ImplementsConsumer implements Consumer<String> {
+ @Override
+ public void accept(String foo) { }
+} \ No newline at end of file
diff --git a/src/test/test-project/workspace/src/org/javacs/other/ImplementsRunnable.java b/src/test/test-project/workspace/src/org/javacs/other/ImplementsRunnable.java
new file mode 100644
index 0000000..6f64355
--- /dev/null
+++ b/src/test/test-project/workspace/src/org/javacs/other/ImplementsRunnable.java
@@ -0,0 +1,6 @@
+package org.javacs.other;
+
+class ImplementsRunnable implements Runnable {
+ @Override
+ public void run() { }
+} \ No newline at end of file