Closed
Description
For the following test two descriptors will be created -- one for @ParameterizedTest
and another for @Test
:
@ParameterizedTest
@ValueSource(strings = "blah")
@Test
void blah(String blah) {}
The parameterized test passes, while the other one fails because JUnit Juiter cannot resolve the parameter:
org.junit.jupiter.api.extension.ParameterResolutionException: No ParameterResolver registered for parameter [java.lang.String arg0] in executable [void io.qala.datagen.junit5.Junit5ParameterizedTest.blah(java.lang.String)].
I don't know if it's a bug or a feature, but because I didn't know about this I spent an hour debugging JUnit. I assume many more people could step on this, so would be great to make the logic more obvious. Couple of options:
- Ignore
@Test
if some other test descriptor is created - Make error message clearer:
... This can happen e.g. if 2 different Test annotations are put on one method.
- Use mechanisms for creating Test Descriptors similar to how ParameterResolver works:
boolean supportsTest(...)