diff --git a/error-prone-contrib/pom.xml b/error-prone-contrib/pom.xml
index f7a2f1b8b2..4976221457 100644
--- a/error-prone-contrib/pom.xml
+++ b/error-prone-contrib/pom.xml
@@ -130,7 +130,6 @@
org.junit.jupiter
junit-jupiter-params
- test
org.mockito
diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/JUnitArgumentsTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/JUnitArgumentsTemplates.java
new file mode 100644
index 0000000000..53e0c6d501
--- /dev/null
+++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/JUnitArgumentsTemplates.java
@@ -0,0 +1,32 @@
+package tech.picnic.errorprone.refastertemplates;
+
+import static org.junit.jupiter.params.provider.Arguments.arguments;
+
+import com.google.errorprone.refaster.ImportPolicy;
+import com.google.errorprone.refaster.annotation.AfterTemplate;
+import com.google.errorprone.refaster.annotation.BeforeTemplate;
+import com.google.errorprone.refaster.annotation.Repeated;
+import com.google.errorprone.refaster.annotation.UseImportPolicy;
+import org.junit.jupiter.params.provider.Arguments;
+
+/**
+ * Refaster templates which replaces argument creation for parametrized JUnit tests using {@link
+ * Arguments#of} with statically imported {@link Arguments#arguments} calls.
+ */
+final class JUnitArgumentsTemplates {
+ private JUnitArgumentsTemplates() {}
+
+ /** Prefer statically imported {@link Arguments#arguments} over {@link Arguments#of} calls. */
+ static final class ArgumentsReplace {
+ @BeforeTemplate
+ Arguments before(@Repeated T objs) {
+ return Arguments.of(objs);
+ }
+
+ @AfterTemplate
+ @UseImportPolicy(ImportPolicy.STATIC_IMPORT_ALWAYS)
+ Arguments after(@Repeated T objs) {
+ return arguments(objs);
+ }
+ }
+}
diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RefasterCheckTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RefasterCheckTest.java
index a4b0a1a968..15848eb919 100644
--- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RefasterCheckTest.java
+++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RefasterCheckTest.java
@@ -57,6 +57,7 @@ public final class RefasterCheckTest {
"ImmutableSortedMultiset",
"ImmutableSortedSet",
"IntStream",
+ "JUnitArguments",
"LongStream",
"MapEntry",
"Mockito",
diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/bugpatterns/JUnitArgumentsTemplatesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/bugpatterns/JUnitArgumentsTemplatesTestInput.java
new file mode 100644
index 0000000000..6ca86ff4c7
--- /dev/null
+++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/bugpatterns/JUnitArgumentsTemplatesTestInput.java
@@ -0,0 +1,22 @@
+package tech.picnic.errorprone.bugpatterns;
+
+import java.util.stream.Stream;
+import org.junit.jupiter.params.provider.Arguments;
+
+final class JUnitTemplatesTest implements RefasterTemplateTestCase {
+ Arguments testSingle() {
+ return Arguments.of("foo");
+ }
+
+ Arguments testMultiple() {
+ return Arguments.of(1, "foo", 2, "bar");
+ }
+
+ Stream testSingleInStream() {
+ return Stream.of(Arguments.of("foo"));
+ }
+
+ Stream testMultipleInStream() {
+ return Stream.of(Arguments.of(1, "foo", 2, "bar"));
+ }
+}
diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/bugpatterns/JUnitArgumentsTemplatesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/bugpatterns/JUnitArgumentsTemplatesTestOutput.java
new file mode 100644
index 0000000000..8004b7ec9d
--- /dev/null
+++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/bugpatterns/JUnitArgumentsTemplatesTestOutput.java
@@ -0,0 +1,24 @@
+package tech.picnic.errorprone.bugpatterns;
+
+import static org.junit.jupiter.params.provider.Arguments.arguments;
+
+import java.util.stream.Stream;
+import org.junit.jupiter.params.provider.Arguments;
+
+final class JUnitTemplatesTest implements RefasterTemplateTestCase {
+ Arguments testSingle() {
+ return arguments("foo");
+ }
+
+ Arguments testMultiple() {
+ return arguments(1, "foo", 2, "bar");
+ }
+
+ Stream testSingleInStream() {
+ return Stream.of(arguments("foo"));
+ }
+
+ Stream testMultipleInStream() {
+ return Stream.of(arguments(1, "foo", 2, "bar"));
+ }
+}