Fixed JUnit Jupiter parallel issue#1789
Conversation
Fixes #1630 This fix improves Mockito JUnit Jupiter extension. However, it does not completely resolve all kinds of parallel issues when nested test classes are used. I'll open separate ticket for it.
TimvdLippe
left a comment
There was a problem hiding this comment.
It would be nicer to pass in the parent directly from the context to avoid some boolean logic that is harder to follow. Other than that: nice and easy test case!
| private void collectParentTestInstances(ExtensionContext context, Set<Object> testInstances) { | ||
| Optional<ExtensionContext> parent = context.getParent(); | ||
|
|
||
| boolean firstParent = true; |
There was a problem hiding this comment.
Instead of having a boolean here, can we pass in context.getParent() on line 164. E.g. we pass the first parent in already, but then we keep all the other logic the same. That seems a little bit nicer to me and easier to follow. The comment can then be placed before line 164 instead.
There was a problem hiding this comment.
Please push a commit to this branch - it's simpler!
There was a problem hiding this comment.
Sadly I am not at my working computer. I can do a push on Monday if you prefer.
There was a problem hiding this comment.
This works :-) Push on Monday. Have a nice weekend!
Codecov Report
@@ Coverage Diff @@
## release/3.x #1789 +/- ##
=================================================
+ Coverage 86.58% 86.59% +<.01%
- Complexity 2491 2492 +1
=================================================
Files 310 310
Lines 6562 6566 +4
Branches 822 823 +1
=================================================
+ Hits 5682 5686 +4
Misses 682 682
Partials 198 198
Continue to review full report at Codecov.
|
|
This is much nicer, thank you!!! |
Fixes #1630
This fix improves Mockito JUnit Jupiter extension. However, it does not completely resolve all kinds of parallel issues when nested test classes are used. I'll open a separate ticket for it.