Skip to content

@ParameterizedTest ignores additional arguments beyond formal parameter list #3708

Description

junit-jupiter-params-5.9.2

Steps to reproduce

    private static Stream<Arguments> fooData() {
        return Stream.of(
            Arguments.of("1",
            Arguments.of(""))
        );
    }

    @ParameterizedTest
    @MethodSource("fooData")
    void testFoo(final String fooString) {
        assertFalse(fooString.isEmpty());
    }

I would expect a runtime error as the stream of arguments return in fooData() aren't compatible with testFoo(String s). In this instance, only the first argument (i.e. "1") is fed to testFoo(), all other arguments are unceremoniously dropped on the floor. Note that the second argument (i.e., "") is not tested and would have led to a unit test failure.

Context

  • Used versions (Jupiter/Vintage/Platform): 5.9.2
  • Build Tool/IDE: IntelliJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions