suppress warning and fix an occurence

This commit is contained in:
Vincent Koeman
2023-10-06 17:45:28 +02:00
parent 10dfe9d732
commit efd3a9a002
3 changed files with 8 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ final class JUnitRules {
}
@AfterTemplate
@SuppressWarnings("JUnitSingleArguments" /* The bugpattern does not understand Repeated. */)
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
Arguments after(@Repeated T objects) {
return arguments(objects);

View File

@@ -9,8 +9,8 @@ final class JUnitSingleArgumentsTest {
CompilationTestHelper.newInstance(JUnitSingleArguments.class, getClass())
.addSourceLines(
"A.java",
"import static java.util.function.Function.identity;",
"import static java.util.Objects.requireNonNull;",
"import static java.util.function.Function.identity;",
"import static org.junit.jupiter.params.provider.Arguments.arguments;",
"",
"class A {",
@@ -20,7 +20,7 @@ final class JUnitSingleArgumentsTest {
" // BUG: Diagnostic contains:",
" arguments(1);",
" arguments(1,2);",
" ",
"",
" identity();",
" requireNonNull(null);",
" }",

View File

@@ -2,7 +2,6 @@ package tech.picnic.errorprone.bugpatterns.util;
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.BugPattern;
@@ -17,7 +16,6 @@ import com.sun.source.tree.MethodInvocationTree;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
final class MethodMatcherFactoryTest {
@@ -29,13 +27,13 @@ final class MethodMatcherFactoryTest {
"com.example.A#m2(java.lang.String)",
"com.example.sub.B#m3(int,int)"));
private static Stream<Arguments> createWithMalformedSignaturesTestCases() {
private static Stream<ImmutableList<String>> createWithMalformedSignaturesTestCases() {
/* { signatures } */
return Stream.of(
arguments(ImmutableList.of("foo.bar")),
arguments(ImmutableList.of("foo.bar#baz")),
arguments(ImmutableList.of("a", "foo.bar#baz()")),
arguments(ImmutableList.of("foo.bar#baz()", "a")));
ImmutableList.of("foo.bar"),
ImmutableList.of("foo.bar#baz"),
ImmutableList.of("a", "foo.bar#baz()"),
ImmutableList.of("foo.bar#baz()", "a"));
}
@MethodSource("createWithMalformedSignaturesTestCases")