-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Regression: Parameterized test written in Kotlin fails after upgrade to v5.4.0 #1836
Comments
Thanks for raising this issue. The stack trace points to... ...will copy your test into https://github.com/junit-team/junit5/tree/master/junit-jupiter-params/src/test/kotlin to reproduce the error. |
Mh, I can't reproduce it on See d35b0a1 for a working example using |
I think you can't reproduce the issue because my example is wrong. I reduced it too much from my original test. Can you try it with the following data? @JvmStatic
fun data() = arrayOf(
arrayOf("A", 1),
arrayOf("B", 2),
arrayOf("C", 3),
arrayOf("", 4),
arrayOf(null, 5) //null is a problem
) |
Ah! That changes everything. Can reproduce it now. |
Prior to this commit Arrays.copyOf() was used to create a human-readable names for parameterized tests. That method preserves the underlying type of the source array, which isn't always Object[]. But Object[] is required within the makeReadable() method as it may assign an instance of String to an index of the result array. Now, a two step solution is implemented: - create a new Object[] with the appropriate size - copy elements to that array via System.arraycopy() Fixes #1836
With #1837 applied, it looks better now: |
Prior to this commit Arrays.copyOf() was used without specifying the resulting array type in order to create a human-readable names for parameterized tests. Now, type `Object[]` is passed as an argument to ensure the resulting array may contain any valid instance, here an instance of `String`. Fixes #1836
Prior to this commit Arrays.copyOf() was used without specifying the resulting array type in order to create a human-readable names for parameterized tests. Now, type `Object[]` is passed as an argument to ensure the resulting array may contain any valid instance, here an instance of `String`. Fixes #1836
Wow, that was fast! When will your fix land in a stable version? |
@ChristianSchwarz I'll release 5.4.2 tonight. |
Prior to this commit Arrays.copyOf() was used without specifying the resulting array type in order to create a human-readable names for parameterized tests. Now, type `Object[]` is passed as an argument to ensure the resulting array may contain any valid instance, here an instance of `String`. Fixes #1836
After upgrading from 5.3.1 to 5.4.0 the following Kotlin test failes.
Note: The Kotlin version (1.3.21) have not been change .
Fails with Exception:
Full Stacktrace
The text was updated successfully, but these errors were encountered: