Skip to content

Ensure Jupiter's assertions/assumptions are self-contained #4749

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

Merged
merged 4 commits into from
Jul 12, 2025

Conversation

marcphilipp
Copy link
Member

@marcphilipp marcphilipp commented Jul 10, 2025

  • Avoid reference to Assertions class from production code
  • Add ArchUnit rule ensuring Jupiter Assertions are self-contained
  • Add Checkstyle rule ensuring Jupiter Assertions are self-contained
  • Document how to use Checkstyle rules to forbid Jupiter assertions

Resolves #4604.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

`SeparateThreadTimeoutInvocation` called an internal overload of
`Assertions.assertTimeoutPreemptively` to avoid having to duplicate the
implementation of executing a block of code with a preemptive timeout.
Instead, this commit moves the shared code to a new
`PreemptiveTimeoutUtils` class in the new `org.junit.jupiter.api.util`
package which is only exported to the `org.junit.jupiter.engine` module.
@marcphilipp marcphilipp force-pushed the marc/4604-self-contained-assertions branch from 12e19ae to 8e4e326 Compare July 12, 2025 11:25
@marcphilipp marcphilipp merged commit 7c41b13 into main Jul 12, 2025
15 checks passed
@marcphilipp marcphilipp deleted the marc/4604-self-contained-assertions branch July 12, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure Jupiter's assertions are self-contained
1 participant