summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/javacs/WarningsTest.java8
-rw-r--r--src/test/test-project/workspace/src/org/javacs/warn/Unused.java6
2 files changed, 11 insertions, 3 deletions
diff --git a/src/test/java/org/javacs/WarningsTest.java b/src/test/java/org/javacs/WarningsTest.java
index f9e54d4..c82c80f 100644
--- a/src/test/java/org/javacs/WarningsTest.java
+++ b/src/test/java/org/javacs/WarningsTest.java
@@ -31,9 +31,11 @@ public class WarningsTest {
@Test
public void unusedLocal() {
server.reportErrors(List.of(FindResource.uri("org/javacs/warn/Unused.java")));
- assertThat(errors, hasItem("unused(5)")); // int unusedLocal
- assertThat(errors, hasItem("unused(8)")); // int unusedPrivate
- assertThat(errors, not(hasItem("unused(4)")));
+ assertThat(errors, hasItem("unused(7)")); // int unusedLocal
+ assertThat(errors, hasItem("unused(10)")); // int unusedPrivate
+ assertThat(errors, hasItem("unused(13)")); // int unusedLocalInLambda
+ assertThat(errors, not(hasItem("unused(6)"))); // test(int unusedParam)
+ assertThat(errors, not(hasItem("unused(12)"))); // unusedLambdaParam -> {};
}
// 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 94e04b7..7852379 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
@@ -1,9 +1,15 @@
package org.javacs.warn;
+import java.util.function.Consumer;
+
class Unused {
void test(int unusedParam) {
int unusedLocal = 1;
}
private int unusedPrivate;
+
+ Consumer<Integer> lambda = unusedLambdaParam -> {
+ int unusedLocalInLambda;
+ };
} \ No newline at end of file