From 971ed1ba1f170ada4e171c1e72eda77840655f5e Mon Sep 17 00:00:00 2001 From: George Fraser Date: Sat, 5 Jan 2019 18:10:43 -0800 Subject: Test cross-package goto --- src/test/java/org/javacs/GotoTest.java | 14 ++++++++++++++ .../src/org/javacs/example/GotoOtherPackageMethod.java | 13 +++++++++++++ .../workspace/src/org/javacs/other/ImplementsConsumer.java | 8 ++++++++ .../workspace/src/org/javacs/other/ImplementsRunnable.java | 6 ++++++ 4 files changed, 41 insertions(+) create mode 100644 src/test/test-project/workspace/src/org/javacs/example/GotoOtherPackageMethod.java create mode 100644 src/test/test-project/workspace/src/org/javacs/other/ImplementsConsumer.java create mode 100644 src/test/test-project/workspace/src/org/javacs/other/ImplementsRunnable.java (limited to 'src/test') 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 @@ -147,6 +147,20 @@ public class GotoTest { assertThat(doGoto(file, 5, 18), hasItems("GotoImplementation.java:9", "GotoImplementation.java:14")); } + @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 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 { + @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 -- cgit v1.2.3