-
-
Couldn't load subscription status.
- Fork 1.6k
Milestone
Description
Steps to reproduce
Running the following test class fails with an
ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
@ParameterizedClass
@ValueSource(ints = 1)
class NotEnoughArgumentsForFieldsTestCase {
@Parameter(0)
int i;
@Parameter(1)
String s;
@Test
void test() {
fail("should not be called");
}
}The error message should indicate that the failure comes from trying to inject an argument into the field annotated with @Parameter(1).
For comparison, when using constructor injection, the following exception is thrown (which is consistent with how missing arguments of @ParameterizedTest methods are handled):
ParameterResolutionException: No ParameterResolver registered for parameter [java.lang.String s] in constructor [NotEnoughArgumentsForConstructorTestCase(int,java.lang.String)
Context
- Used versions (Jupiter/Vintage/Platform): 5.14.x
- Build Tool/IDE: irrelevant
Deliverables
- Throw more specific exception with a clear error message indicating the root cause
sbrannen