Skip to content

@ParameterizedTest that accepts no arguments should fail by default #5759

Description

@pfichtner

A @ParameterizedTest that takes no argument should "fail".

If a @ParameterizedTest does not have any source it fails:

PreconditionViolationException: Configuration error: You must configure at least one arguments source for this @ParameterizedTest

This @ParameterizedTest passes without taking any argument:

@ParameterizedTest
@ValueSource(strings = { "foo", "bar" })
void methodDoesNotTakeAnyParameter() {}

I suggest a @ParameterizedTest to fail if it takes no arguments at all with a PreconditionViolationException or similar, or is there any valid reason to have a @ParameterizedTest without an argument?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions