-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use TestInstances
API from JUnit Jupiter
#2719
Conversation
TestInstances
API from JUnit Jupiter
@britter could you please verify this change? :) |
@bsideup I'm on vacation at the moment. I will have a look next monday. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that TestInstances
was introduced in JUnit Jupiter 5.4.
} | ||
|
||
current = ctx.getParent(); | ||
} | ||
return testInstances; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the order is important, I think this method body can be replaced with:
List<Object> allInstances = new ArrayList<>(ctx.getRequiredTestInstances().getAllInstances());
Collections.reverse(allInstances);
return new LinkedHashSet<>(allInstances);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order isn't important (sine there is no guarantee from the JVM anyways, right?), and we have dependsOn
to enforce it.
Or is there some built-in way of ensuring the order that TestInstances
is using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@britter Used LinkedHashSet (which has ordering guarantees), so I guess the order is important.
I guess the intention is to start containers of parent classes before child classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember why I used a LinkedHashSet to be honest 😇
LGTM |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this. |
This issue has been automatically closed due to inactivity. We apologise if this is still an active problem for you, and would ask you to re-open the issue if this is the case. |
Reopened - sorry, we shouldn't have let this get so stale. |
@rnorth It still shows as "closed" to me. Wrong button? |
Huh, not sure what happened there. Thanks @marcphilipp |
This PR is laying around a bit. Are you still interested in it or should I close it? |
thanks for the contribution @tobiasstadler ! and everyone involved in the review :) |
JUnit Jupiter has an API to get the test instances per test. Let's use it.