From 00012c6aa897a1a87c81548a919000785ea5fa5c Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Sun, 14 Nov 2021 14:39:15 +0100 Subject: [PATCH] Extend `StaticImportCheck` test coverage (#21) --- .../bugpatterns/StaticImportCheckTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StaticImportCheckTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StaticImportCheckTest.java index c17a4d4350..c45c08f75b 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StaticImportCheckTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/StaticImportCheckTest.java @@ -94,6 +94,8 @@ void replacement() { "import com.google.common.collect.ImmutableMap;", "import com.google.common.collect.ImmutableSet;", "import java.nio.charset.StandardCharsets;", + "import java.util.Objects;", + "import org.junit.jupiter.params.provider.Arguments;", "import org.springframework.format.annotation.DateTimeFormat;", "import org.springframework.format.annotation.DateTimeFormat.ISO;", "import org.springframework.boot.test.context.SpringBootTest;", @@ -110,6 +112,10 @@ void replacement() { " Predicates.not(null);", " not(null);", "", + " Arguments.arguments(\"foo\");", + "", + " Objects.requireNonNull(\"bar\");", + "", " Object o = StandardCharsets.UTF_8;", " }", "", @@ -131,7 +137,9 @@ void replacement() { "import static com.google.common.collect.ImmutableMap.toImmutableMap;", "import static com.google.common.collect.ImmutableSet.toImmutableSet;", "import static java.nio.charset.StandardCharsets.UTF_8;", + "import static java.util.Objects.requireNonNull;", "import static java.util.function.Predicate.not;", + "import static org.junit.jupiter.params.provider.Arguments.arguments;", "import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;", "import static org.springframework.format.annotation.DateTimeFormat.ISO.DATE;", "import static org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME;", @@ -141,6 +149,8 @@ void replacement() { "import com.google.common.collect.ImmutableMap;", "import com.google.common.collect.ImmutableSet;", "import java.nio.charset.StandardCharsets;", + "import java.util.Objects;", + "import org.junit.jupiter.params.provider.Arguments;", "import org.springframework.boot.test.context.SpringBootTest;", "import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;", "import org.springframework.format.annotation.DateTimeFormat;", @@ -157,6 +167,10 @@ void replacement() { " Predicates.not(null);", " not(null);", "", + " arguments(\"foo\");", + "", + " requireNonNull(\"bar\");", + "", " Object o = UTF_8;", " }", "",