Skip to content

Fixed JUnit Jupiter parallel issue#1789

Merged
mockitoguy merged 2 commits intorelease/3.xfrom
sf
Sep 30, 2019
Merged

Fixed JUnit Jupiter parallel issue#1789
mockitoguy merged 2 commits intorelease/3.xfrom
sf

Conversation

@mockitoguy
Copy link
Copy Markdown
Member

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.

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.
Copy link
Copy Markdown
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please push a commit to this branch - it's simpler!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly I am not at my working computer. I can do a push on Monday if you prefer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works :-) Push on Monday. Have a nice weekend!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done PTAL

@codecov-io
Copy link
Copy Markdown

codecov-io commented Sep 29, 2019

Codecov Report

Merging #1789 into release/3.x will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@                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
Impacted Files Coverage Δ Complexity Δ
...va/org/mockito/junit/jupiter/MockitoExtension.java 91.48% <100%> (+0.79%) 14 <0> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 214d465...5ed8a07. Read the comment docs.

@mockitoguy
Copy link
Copy Markdown
Member Author

This is much nicer, thank you!!!

@mockitoguy mockitoguy merged commit 30c50fa into release/3.x Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mockito JUnit Jupiter extension does not correctly support parallel test execution

3 participants