junit-team/junit5 · error · JUnitException

ArgumentsProvider does not override the…

Error message

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

What it means

Thrown by the default provideArguments(ParameterDeclarations, ExtensionContext) on ArgumentsProvider when delegating to the deprecated single-arg method raises any Exception. The bridge catches it and rethrows as JUnitException instructing the user to report to the maintainers of the provider class. It indicates the provider did not override the new method and the legacy fallback path failed.

Solutions

  1. Implement provideArguments(ParameterDeclarations, ExtensionContext) directly in the provider class.
  2. Inspect the wrapped cause exception for the underlying failure (e.g. UnsupportedOperationException) and address it.
  3. Update the provider library to a JUnit 6-compatible release.

Example fix

// before
public class MyProvider implements ArgumentsProvider {
  // no override -> bridge throws
}

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

Strategy: try-catch

Validate before calling

// Inspect provider class for a non-default override of the new method
Method m;
try {
    m = providerClass.getMethod("provideArguments", ParameterDeclarations.class, ExtensionContext.class);
} catch (NoSuchMethodException e) {
    throw new IllegalStateException("provider does not declare the new method", e);
}
if (m.isDefault()) throw new IllegalStateException("provider relies on the default bridge");

Try / catch

try {
    provider.provideArguments(parameters, context);
} catch (JUnitException e) {
    if (e.getMessage().contains("does not override the provideArguments")) {
        // migrate the provider or upgrade the extension library
    }
    throw e;
}

Prevention

When it happens

Trigger: An ArgumentsProvider subclass that overrides neither the new 2-arg method nor the legacy 1-arg method correctly, causing the legacy default to throw UnsupportedOperationException (or another exception). The bridge in the new default catches that and wraps it.

Common situations: Upgrading to JUnit 6.x where the new method is the only maintained entry point. A provider that relied on the deprecated default without implementing anything. Provider whose legacy implementation throws for unrelated reasons.

Related errors


AI-assisted analysis of junit-team/junit5@f070c699a0 (2026-08-11). Data as JSON: /api/errors/3ac8953d744169c4. Report an issue: GitHub.

Appendix: 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 f070c699a0)