-
Notifications
You must be signed in to change notification settings - Fork 79
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
junit4->5 rewrites @Test(1000 /*ms*/) to @Timeout(1000 /*sec*/) which breaks test logic #450
Comments
That's indeed a bug, and a nasty one at that as well. Thanks for pointing it out! |
It might make sense to add a rewrite rule that would detect "too large timeouts" and suggest converting them to seconds. As a workaround, users could type So the rewrite rule could be |
Yes I indeed think a separate recipe is in order that detects and corrects such implausible values; See also #451 (comment) |
Should be fixed for the time being; would you want to log a separate issue for detecting implausible timeouts and simplifying existing timeouts? |
I've filed #452 |
What version of OpenRewrite are you using?
latest.integration
JUnit4 uses milliseconds for the timeout (there's no way to configure the unit), and JUnit5 uses
TimeUnit.SECONDS
by default.I believe this is a wrong test:
rewrite-testing-frameworks/src/test/java/org/openrewrite/java/testing/junit5/UpdateTestAnnotationTest.java
Lines 275 to 302 in 326c048
I think OpenRewrite should convert
@Test(timeout = 5000)
to@Timeout(5)
; and it should convert@Test(timeout = 500)
to@Timeout(value = 500, unit = TimeUnit.MILLISECONDS)
.The text was updated successfully, but these errors were encountered: