-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support void
class lookups in ReflectionUtils
#4048
Comments
Did you deliberately not use the @ValueSource(classes = { void.class, ... })
@ParameterizedTest
void isPrimitive(Class<?> candidate) {
assertTrue(candidate.isPrimitive());
} That being said, I see no reason not to add support for "void" |
"void"
and "Void"
to Class
If my memory serves me correctly, it was indeed intentional since And since we never had a concrete use case for supporting conversions for those in JUnit itself, we didn't introduce those mappings. Though, I agree with @marcphilipp that it should be fine to add lookups for those in |
I quickly switched to |
Both the primitive type `void` and the wrapper type `Void` are now supported in the internal `ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests. Fixes #4048. --------- Co-authored-by: Marc Philipp <mail@marcphilipp.de>
"void"
and "Void"
to Class
void
and Void
to Class
Technically speaking, So, it looks like we actually made two changes.
Admittedly, that's a bit nuanced, but perhaps we should revise the release notes and documentation accordingly. |
void
and Void
to Class
void
and Void
class lookups in ReflectionUtils
Reopening to address those concerns. |
As a side note, I'm not so sure that the following should actually pass. assertTrue(ReflectionUtils.isAssignableTo(Void.class, void.class)); Rationale: In light of that, I think we should either:
@marcphilipp, thoughts? |
void
and Void
class lookups in ReflectionUtils
void
class lookups in ReflectionUtils
I updated the documentation in 57e20cd, but I'm leaving this open to address the following.
|
@sbrannen Good catch!
I'm in favor of removing the wrapper registration because, as you pointed out, the |
Running following parametrized test in JUnit 5.11
only makes the "void" case fail.
It looks like conversion of "void" to Class isn't supported.
Both
classNameToTypeMap
andprimitiveToWrapperMap
oforg.junit.platform.commons.util.ReflectionUtils
are lackingvoid.class
andVoid.class
, but maybe this is by intention.The text was updated successfully, but these errors were encountered: