summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-01-05 13:57:10 -0800
committerGeorge Fraser <george@fivetran.com>2019-01-05 13:57:10 -0800
commitb0c116dced0be0ab8ea7b2def7ae244c03236d62 (patch)
treed2dcc2a97b156697b493a32f48047cf91cb3c07f /src/test
parent0d86af4b0fe9ccc4f0a5bb25669ec5906a2c5ed0 (diff)
downloadjava-language-server-b0c116dced0be0ab8ea7b2def7ae244c03236d62.zip
More unused
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/javacs/WarningsTest.java3
-rw-r--r--src/test/test-project/workspace/src/org/javacs/warn/Unused.java8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/WarningsTest.java b/src/test/java/org/javacs/WarningsTest.java
index c82c80f..09154c2 100644
--- a/src/test/java/org/javacs/WarningsTest.java
+++ b/src/test/java/org/javacs/WarningsTest.java
@@ -34,8 +34,11 @@ public class WarningsTest {
assertThat(errors, hasItem("unused(7)")); // int unusedLocal
assertThat(errors, hasItem("unused(10)")); // int unusedPrivate
assertThat(errors, hasItem("unused(13)")); // int unusedLocalInLambda
+ assertThat(errors, hasItem("unused(16)")); // int unusedMethod() { ... }
+ assertThat(errors, hasItem("unused(22)")); // private Unused(int i) { }
assertThat(errors, not(hasItem("unused(6)"))); // test(int unusedParam)
assertThat(errors, not(hasItem("unused(12)"))); // unusedLambdaParam -> {};
+ assertThat(errors, not(hasItem("unused(20)"))); // private Unused() { }
}
// TODO warn on type.equals(otherType)
diff --git a/src/test/test-project/workspace/src/org/javacs/warn/Unused.java b/src/test/test-project/workspace/src/org/javacs/warn/Unused.java
index 7852379..c8d0be3 100644
--- a/src/test/test-project/workspace/src/org/javacs/warn/Unused.java
+++ b/src/test/test-project/workspace/src/org/javacs/warn/Unused.java
@@ -12,4 +12,12 @@ class Unused {
Consumer<Integer> lambda = unusedLambdaParam -> {
int unusedLocalInLambda;
};
+
+ private int unusedMethod() {
+ return 0;
+ }
+
+ private Unused() { }
+
+ private Unused(int i) { }
} \ No newline at end of file