add more test to describe more request on jmockit requests. #662
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?
Base on my actual working case, I add some test cases, which describes my hope on the enhancement behaviors of jmockit recipes.
What's your motivation?
I hope the JMockit recipe can be more flexible.
Anything in particular you'd like reviewers to focus on?
Some of the test are conflicting with current test, it is just a suggestion based on my actual cases. But I don't know much about other ones scenario, so please just take it as a discussion and pick up whatever you guys think make sense.
My tests are mainly on following points
During replay, invocations matching a recorded expectation must occur at least once (unless specified otherwise); if, by the end of the test, no matching invocation occurred for a given recorded expectation, the test will fail with a MissingInvocation error.
fromhttps://javadoc.io/doc/org.jmockit/jmockit/latest/index.html
.JMockit can setup expectations in setup methods or util methods, those mock need also be handled. If it's not easy to handle it all atomatically, I personally think create the mock and leave an TODO message might be a possible solution.
In my case, the doReturn().when().xxx() form of mocking will be more rubost than when(a.b()).thenReturn(c) form, since the latter form sometimes will throw NPE, but the former one seems never have this problem.
Checklist