JUnit 5 "must declare at least one ArgumentsSource" - Fix
A JUnit 5 @ParameterizedTest ran with no argument source. Either you forgot the @ValueSource/@MethodSource/@CsvSource annotation, or junit-jupiter-params is not on the test classpath so the parameterized infrastructure is absent.
What this error means
The test errors (not fails) with Configuration error: You must configure at least one set of arguments for this @ParameterizedTest or org.junit.jupiter.params... cannot be found. The method is detected but cannot be supplied inputs.
org.junit.jupiter.api.extension.ParameterResolutionException:
Configuration error: You must configure at least one set of arguments for
this @ParameterizedTest
at org.junit.jupiter.params.ParameterizedTestExtension...Diagnose it: resolve the effective POM first
Maven merges parent POMs, profiles, and settings before it builds anything. The configuration causing your failure is frequently inherited or activated by a profile that is on locally and off in CI.
# the fully resolved configuration Maven will actually use
mvn help:effective-pom | head -60
# which profiles are active here vs on your machine?
mvn help:active-profiles
# full error, offline-safe, no colour codes to confuse the log
mvn -B -e -X <goal> 2>&1 | tail -60Common causes
No arguments-source annotation
The method is @ParameterizedTest but lacks @ValueSource/@MethodSource/@CsvSource, so JUnit has nothing to feed it.
junit-jupiter-params not on the classpath
Only junit-jupiter-api was added; the params module that provides parameterized support is missing.
A @MethodSource that resolves to nothing
The referenced factory method returns an empty stream or is not static/visible, so no arguments are produced.
How to fix it
Add an arguments source
Provide the inputs the parameterized test consumes.
@ParameterizedTest
@ValueSource(ints = {1, 2, 3})
void isPositive(int n) { assertTrue(n > 0); }Add junit-jupiter-params
Ensure the params module is on the test classpath.
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0'Fix a @MethodSource factory
Make the factory static and ensure it returns a non-empty stream.
static Stream<Arguments> cases() {
return Stream.of(Arguments.of(1, "a"), Arguments.of(2, "b"));
}How to prevent it
- Always pair
@ParameterizedTestwith an explicit arguments source. - Include
junit-jupiter-paramsalongside the API and engine. - Keep
@MethodSourcefactories static and non-empty.