Correcty parameterized test class fails in JUnit 5

You don’t need @Test when using @ParameterizedTest as this will result in an additional execution of your test. This additional execution expects an int to be passed to the test but there is no resolver for this and hence the test fails with the exception you posted.

@ParameterizedTest
@MethodSource("data")
public void test(int e){
    System.out.println("e = " + e);
}

private static Stream data(){
    return Stream.of(
        Arguments.of(1),
        Arguments.of(2)
    );
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top