I'm trying to develop a parameterized test in JUnit 5, as in the example below.
@ParameterizedTest
@ArgumentsSource(ArgClassProvider.class)
void testAction_shouldSmth(ArgClass argClass) {
//...
}
class ArgClassProvider implements ArgumentsProvider {
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext extensionContext) throws Exception {
return Stream.of(new ArgClass(), new ArgClass()).map(Arguments::of);
}
}
Attempt to run test causes exception:
java.lang.NoSuchMethodException: com.ots.platform_sl.service.config.service.EarnMilesServiceTestHotels$ArgClassProvider.<init>()
...
org.junit.platform.commons.util.PreconditionViolationException: Configuration error: You must provide at least one argument for this @ParameterizedTest
...
You must provide at least one argument for this @ParameterizedTest
This message makes me feel, that I'm doing something wrong, am not I?
p. s. I have an assumption, that only args of primitive types are available.