You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code is correctly updated and the assertTrue import is correctly removed but import static org.junit.jupiter.api.Assertions.assertInstanceOf; is not added.
The text was updated successfully, but these errors were encountered:
Thanks for the report! It looks like there were some missing types related to how the JavaTemplate was used, which in the past we've seen lead to failure to add imports as the maybeAddImport requires correct type information. I've addressed this in 4de7603, and hope this results in a fix for you as well; would you mind trying again with the latest snapshot version when you have a chance?
It works. My only complain it that it moves to a start import if there are 3 explicit imports. For me it should just add import static org.junit.jupiter.api.Assertions.assertInstanceOf;
Hmm that's odd; typically we detect with a project wide tally at which point to switch from individual imports to star imports. Is the project already consistently using more than three before it uses star imports? Or might there be a couple cases where it's eagerly using star imports for fewer items?
Interesting. You can try with EasyMock. There's only one usage of import static org.junit.jupiter.api.Assertions.* in the project. Everything else are explicit imports. However, import static org.easymock.EasyMock.* is used all over the place. So maybe that erratic style causes the issue.
What version of OpenRewrite are you using?
rewrite-testing-frameworks:3.8.0
How are you running OpenRewrite?
Maven
What is the smallest, simplest way to reproduce the problem?
Run the recipe on a test with
assertTrue(e instanceof List)
where the assert is a static importThe code is correctly updated and the
assertTrue
import is correctly removed butimport static org.junit.jupiter.api.Assertions.assertInstanceOf;
is not added.The text was updated successfully, but these errors were encountered: