diff options
author | George Fraser <george@fivetran.com> | 2019-01-05 18:11:58 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2019-01-05 18:11:58 -0800 |
commit | 383c72893163c75b04ca84e4e05f0c25d94dd64f (patch) | |
tree | 6da6340f580a2605d35d6d6ae11e4074d71d795c /src/test | |
parent | 971ed1ba1f170ada4e171c1e72eda77840655f5e (diff) | |
download | java-language-server-383c72893163c75b04ca84e4e05f0c25d94dd64f.zip |
Prune using package names
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/javacs/BenchmarkStringSearch.java | 77 | ||||
-rw-r--r-- | src/test/java/org/javacs/FindReferencesTest.java | 3 | ||||
-rw-r--r-- | src/test/java/org/javacs/ParserTest.java | 6 |
3 files changed, 3 insertions, 83 deletions
diff --git a/src/test/java/org/javacs/BenchmarkStringSearch.java b/src/test/java/org/javacs/BenchmarkStringSearch.java deleted file mode 100644 index 1c453d2..0000000 --- a/src/test/java/org/javacs/BenchmarkStringSearch.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.javacs; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.concurrent.TimeUnit; -import org.openjdk.jmh.annotations.*; - -// TODO this is coloring badly -@Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS) -@Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS) -@Fork(1) -public class BenchmarkStringSearch { - private static final Path largeFile = Paths.get(FindResource.uri("/org/javacs/example/LargeFile.java")), - smallFile = Paths.get(FindResource.uri("/org/javacs/example/Goto.java")); - // "removeMethodBodies" appears late in the file, so stopping early will not be very effective - private static final String query = "removeMethodBodies"; - - @Benchmark - public void containsWordMatchingSmall() { - var found = Parser.containsWordMatching(smallFile, query); - assert found; - } - - @Benchmark - public void containsWordMatchingLarge() { - var found = Parser.containsWordMatching(largeFile, query); - assert found; - } - - @Benchmark - public void containsTextSmall() { - var found = Parser.containsText(smallFile, query); - assert found; - } - - @Benchmark - public void containsTextLarge() { - var found = Parser.containsText(largeFile, query); - assert found; - } - - @Benchmark - public void containsImportLarge() { - var found = JavaCompilerService.containsImport("java.util.nopkg", "Logger", largeFile); - assert found; - } - - @Benchmark - public void containsImportSmall() { - var found = JavaCompilerService.containsImport("java.util.nopkg", "Logger", smallFile); - assert found; - } - - @Benchmark - public void containsWordLarge() { - var found = JavaCompilerService.containsWord("removeMethodBodies", largeFile); - assert found; - } - - @Benchmark - public void containsWordSmall() { - var found = JavaCompilerService.containsWord("removeMethodBodies", smallFile); - assert found; - } - - @Benchmark - public void parseLarge() { - var found = Parser.parse(largeFile); - assert found != null; - } - - @Benchmark - public void parseSmall() { - var found = Parser.parse(smallFile); - assert found != null; - } -} diff --git a/src/test/java/org/javacs/FindReferencesTest.java b/src/test/java/org/javacs/FindReferencesTest.java index a9d1c0a..a4be019 100644 --- a/src/test/java/org/javacs/FindReferencesTest.java +++ b/src/test/java/org/javacs/FindReferencesTest.java @@ -5,13 +5,10 @@ import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; -import java.util.logging.Logger; import org.javacs.lsp.*; import org.junit.Test; public class FindReferencesTest { - private static final Logger LOG = Logger.getLogger("main"); - private static final JavaLanguageServer server = LanguageServerFixture.getJavaLanguageServer(); protected List<String> items(String file, int row, int column) { diff --git a/src/test/java/org/javacs/ParserTest.java b/src/test/java/org/javacs/ParserTest.java index 93ac5ed..92663a9 100644 --- a/src/test/java/org/javacs/ParserTest.java +++ b/src/test/java/org/javacs/ParserTest.java @@ -42,9 +42,9 @@ public class ParserTest { @Test public void largeFilePossibleReference() { var largeFile = Paths.get(FindResource.uri("/org/javacs/example/LargeFile.java")); - assertTrue(JavaCompilerService.containsImport("java.util.logging", "Logger", largeFile)); - assertTrue(JavaCompilerService.containsWord("removeMethodBodies", largeFile)); - assertFalse(JavaCompilerService.containsWord("removeMethodBodiez", largeFile)); + assertTrue(Parser.containsImport(largeFile, "java.util.logging", "Logger")); + assertTrue(Parser.containsWord(largeFile, "removeMethodBodies")); + assertFalse(Parser.containsWord(largeFile, "removeMethodBodiez")); } @Test |