JMockit to Mockito IllegalArumentException No enum constant VerificationsInOrder #616
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's changed?
IllegalArgumentException generated when running jmockit to mockito recipe on code containing jmockit block VerificationsInOrder, raised here jmockit/jmockit1#729 (comment)
https://javadoc.io/doc/org.jmockit/jmockit/latest/mockit/VerificationsInOrder.html
Stack trace
lang.IllegalArgumentException: No enum constant org.openrewrite.java.testing.jmo
ckit.JMockitBlockType.VerificationsInOrder
[ERROR] java.base/java.lang.Enum.valueOf(Enum.java:273)
[ERROR] org.openrewrite.java.testing.jmockit.JMockitBlockType.valueOf(JMockitB
lockType.java:20)
[ERROR] org.openrewrite.java.testing.jmockit.JMockitUtils.getJMockitBlock(JMoc
kitUtils.java:46)
[ERROR] org.openrewrite.java.testing.jmockit.SetupStatementsRewriter.rewriteMe
thodBody(SetupStatementsRewriter.java:41)
[ERROR] org.openrewrite.java.testing.jmockit.JMockitBlockToMockito$RewriteJMoc
kitBlockVisitor.visitMethodDeclaration(JMockitBlockToMockito.java:66)
[ERROR] org.openrewrite.java.testing.jmockit.JMockitBlockToMockito$RewriteJMoc
kitBlockVisitor.visitMethodDeclaration(JMockitBlockToMockito.java:56)
Anyone you would like to review specifically?
@timtebeek @tinder-dthomson (understand he may be busy)
Have you considered any alternatives or workarounds?
Yes - actually do migrate the above JMockit block. Need to use Mockito inOrder.verify(...). This will take time to do, so for now, just skipping migrating this block without generating exception. Anyway, we should ensure that any unsupported JMockit block types are not migrated, so this fix should be done anyway.
Checklist