summaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2018-12-28 18:16:42 -0800
committerGeorge Fraser <george@fivetran.com>2018-12-28 18:16:42 -0800
commit3bdefe1c30f531c7a646df9b9b14eec232f1fe1b (patch)
tree7e7ec9c7ced8e1f22aa3f80af6e761224e62ce0f /src/test/java
parentcad778ca0daae307de3f34579ddbccccb8088aaf (diff)
downloadjava-language-server-3bdefe1c30f531c7a646df9b9b14eec232f1fe1b.zip
Remove guava
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/javacs/CompletionsTest.java7
-rw-r--r--src/test/java/org/javacs/SearchTest.java9
-rw-r--r--src/test/java/org/javacs/lsp/LspTest.java4
3 files changed, 11 insertions, 9 deletions
diff --git a/src/test/java/org/javacs/CompletionsTest.java b/src/test/java/org/javacs/CompletionsTest.java
index d213a74..e2b657f 100644
--- a/src/test/java/org/javacs/CompletionsTest.java
+++ b/src/test/java/org/javacs/CompletionsTest.java
@@ -3,7 +3,6 @@ package org.javacs;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
-import com.google.common.collect.Lists;
import java.util.stream.Collectors;
import org.javacs.lsp.*;
import org.junit.Ignore;
@@ -501,7 +500,7 @@ public class CompletionsTest extends CompletionsBase {
// Static methods
var items = items(file, 6, 19);
- var suggestions = Lists.transform(items, i -> i.insertText);
+ var suggestions = items.stream().map(i -> i.insertText).collect(Collectors.toList());
assertThat(suggestions, hasItems("ArrayList<>($0)"));
@@ -556,7 +555,7 @@ public class CompletionsTest extends CompletionsBase {
// Static methods
var items = items(file, 4, 25);
- var suggestions = Lists.transform(items, i -> i.label);
+ var suggestions = items.stream().map(i -> i.label).collect(Collectors.toList());
assertThat(suggestions, hasItems("OtherPackagePublic"));
assertThat(suggestions, not(hasItems("OtherPackagePrivate")));
@@ -577,7 +576,7 @@ public class CompletionsTest extends CompletionsBase {
// Static methods
var items = items(file, 5, 14);
- var suggestions = Lists.transform(items, i -> i.label);
+ var suggestions = items.stream().map(i -> i.label).collect(Collectors.toList());
assertThat(suggestions, hasItems("OtherPackagePublic"));
assertThat(suggestions, not(hasItems("OtherPackagePrivate")));
diff --git a/src/test/java/org/javacs/SearchTest.java b/src/test/java/org/javacs/SearchTest.java
index 3ecc567..82a2c21 100644
--- a/src/test/java/org/javacs/SearchTest.java
+++ b/src/test/java/org/javacs/SearchTest.java
@@ -3,12 +3,12 @@ package org.javacs;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
-import com.google.common.base.Joiner;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Set;
+import java.util.StringJoiner;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.javacs.lsp.*;
@@ -23,11 +23,14 @@ public class SearchTest {
@BeforeClass
public static void openSource() throws IOException {
var uri = FindResource.uri("/org/javacs/example/AutocompleteBetweenLines.java");
- var textContent = Joiner.on("\n").join(Files.readAllLines(Paths.get(uri)));
+ var textContent = new StringJoiner("\n");
+ for (var line : Files.readAllLines(Paths.get(uri))) {
+ textContent.add(line);
+ }
var document = new TextDocumentItem();
document.uri = uri;
- document.text = textContent;
+ document.text = textContent.toString();
server.didOpenTextDocument(new DidOpenTextDocumentParams(document));
}
diff --git a/src/test/java/org/javacs/lsp/LspTest.java b/src/test/java/org/javacs/lsp/LspTest.java
index 9ef7c4b..61fc2f3 100644
--- a/src/test/java/org/javacs/lsp/LspTest.java
+++ b/src/test/java/org/javacs/lsp/LspTest.java
@@ -3,11 +3,11 @@ package org.javacs.lsp;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
-import com.google.common.base.Charsets;
import com.google.gson.JsonObject;
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import java.nio.charset.Charset;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@@ -27,7 +27,7 @@ public class LspTest {
var bytes = new byte[available];
var read = buffer.read(bytes);
assert read == available;
- return new String(bytes, Charsets.UTF_8);
+ return new String(bytes, Charset.forName("UTF-8"));
} catch (IOException e) {
throw new RuntimeException(e);
}