Very similar to [how to pass multiple null value for CSVSource]Junit 5 - How to pass in multiple null values for @CsvSource?
I am modifying a test method from single parameter to multiple:
@ParameterizedTest
@NullAndEmptySource
@MethodSource("generateData")
void testSomeMethod(String x,List<String> list) {
doSomethingwith(x);
doAnotherThingWith(list);
}
private static Stream<Arguments> generateData() {
return Stream.of(
Arguments.of("a", Arrays.asList("1","2","3")),
Arguments.of("b", Arrays.asList("1","2","3")),
Arguments.of("foo", Arrays.asList("1","2","3"))
);
}
null and empty testcase added by this annotation @NullAndEmptySource
failed with a ParameterResolutionException:No parameter registered for parameter [java.util.List<java.lang.String> arg1 in method [public void my.pachage.myclass.testSomeMethod]
Could anyone please guide me to pass the test case? I have no idea whether parameters matches because there are two parameters in the method and I don't understand what does the error message mean.