From b2fcc6921103b07980f00df242991d2773f744ed Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Wed, 10 Nov 2021 09:00:39 +0100 Subject: [PATCH] StaticImportCheck: Add extra test cases --- .../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 ee6520dc646..6d6996c7670 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 @@ -87,6 +87,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;", "", @@ -101,6 +103,10 @@ void replacement() { " Predicates.not(null);", " not(null);", "", + " Objects.requireNonNull(\"bar\");", + "", + " Arguments.arguments(\"foo\");", + "", " Object o = StandardCharsets.UTF_8;", " }", "", @@ -119,7 +125,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.format.annotation.DateTimeFormat.ISO.DATE;", "import static org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME;", "import static org.springframework.format.annotation.DateTimeFormat.ISO.TIME;", @@ -128,6 +136,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;", "", @@ -142,6 +152,10 @@ void replacement() { " Predicates.not(null);", " not(null);", "", + " requireNonNull(\"bar\");", + "", + " arguments(\"foo\");", + "", " Object o = UTF_8;", " }", "",