junit-team/junit5 · error · JUnitException

ArgumentsProvider does not override the provideArguments(Par

Error message

ArgumentsProvider does not override the provideArguments(ParameterDeclarations, ExtensionContext) method. Please report this issue to the maintainers of %s.

What it means

The 2-arg provideArguments default in ArgumentsProvider delegates to the deprecated 1-arg method and wraps any resulting exception in a JUnitException with this message and the underlying cause. It surfaces when a provider did not override the current 2-arg contract; the cause is typically the UnsupportedOperationException from error 62.

Source

Thrown at junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java:86

	 *
	 * @param parameters the parameter declarations for the parameterized
	 * class or test; never {@code null}
	 * @param context the current extension context; never {@code null}
	 * @return a stream of arguments; never {@code null}
	 * @since 5.13
	 */
	@API(status = MAINTAINED, since = "6.0.2")
	default Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters, ExtensionContext context)
			throws Exception {
		try {
			return provideArguments(context);
		}
		catch (Exception e) {
			String message = """
					ArgumentsProvider does not override the provideArguments(ParameterDeclarations, ExtensionContext) method. \
					Please report this issue to the maintainers of %s.""".formatted(
				getClass().getName());
			throw new JUnitException(message, e);
		}
	}

}

View on GitHub (pinned to 956246301e)

Solutions

  1. Implement provideArguments(ParameterDeclarations, ExtensionContext) on the provider class named in the message.
  2. Upgrade the third-party provider to a version compatible with the installed JUnit Jupiter.
  3. If the provider is not yours and cannot be upgraded, pin JUnit to a version that matches the provider's contract.

Example fix

// before
class MyProvider implements ArgumentsProvider {
    // missing override -> JUnitException wrapping UnsupportedOperationException
}

// after
class MyProvider implements ArgumentsProvider {
    @Override
    public Stream<? extends Arguments> provideArguments(
            ParameterDeclarations parameters, ExtensionContext context) {
        return Stream.of(Arguments.of("a", "b"));
    }
}
Defensive patterns

Strategy: validation

Validate before calling

// Smoke-test that the provider honors the 2-arg contract before running the suite.
ArgumentsProvider p = new MyProvider();
try {
    p.provideArguments(new ParameterDeclarations() { /* stub */ },
        (ExtensionContext) () -> null);
} catch (JUnitException e) {
    if (e.getMessage().contains("does not override")) {
        throw new AssertionError("Provider needs the 2-arg override", e);
    }
}

Try / catch

try {
    // run parameterized test
} catch (JUnitException e) {
    if (e.getMessage().contains("does not override the provideArguments")) {
        // implement the 2-arg override or upgrade/pin JUnit to match the provider
    } else throw e;
}

Prevention

When it happens

Trigger: A custom @ArgumentsSource provider that overrides neither provideArguments overload; the framework calls the 2-arg default, which calls the 1-arg default, which throws, and the 2-arg default wraps it here.

Common situations: Third-party argument provider built against an older JUnit version; refactored provider that lost its override; mismatched provider/engine versions on the classpath.

Related errors


AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04). Data as JSON: /data/errors/3ac8953d744169c4.json. Report an issue: GitHub.