Visitar URL original
Migrate extensions-tests to JUnit Jupiter by mirkoalicastro · Pull Request #3840 · mockito/mockito · GitHub
Skip to content

Migrate extensions-tests to JUnit Jupiter - #3840

Merged
jselbo merged 4 commits into
mockito:mainfrom
mirkoalicastro:remove-hamcrest-from-extensions-tests
Jul 7, 2026
Merged

jselbo merged 4 commits into
mockito:mainfrom
mirkoalicastro:remove-hamcrest-from-extensions-tests

Conversation

@mirkoalicastro

Copy link
Copy Markdown
Contributor

The extensions tests pulled hamcrest-core transitively via JUnit 4. There was a TODO to exclude it (linked to #154) that was blocked on that dependency.
This PR excludes it migrating the module's JUnit 4 unit tests to JUnit Jupiter, dropping its dependencies, and replacing the stale TODO with an active exclude of the hamcrest dependency.

@codecov-commenter

codecov-commenter commented Jul 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.84%. Comparing base (f3cf74c) to head (df0c334).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #3840   +/-   ##
=========================================
  Coverage     86.84%   86.84%           
  Complexity     3044     3044           
=========================================
  Files           344      344           
  Lines          9172     9172           
  Branches       1135     1135           
=========================================
  Hits           7965     7965           
  Misses          917      917           
  Partials        290      290           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jselbo

jselbo commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Sorry, I don't really see the value in this. I don't see the problem with these tests depending on Hamcrest via JUnit4. Maybe I am missing the context from ten years ago, but I'd prefer just removing the TODO.

If we want to migrate all integration tests to Jupiter JUnit that's another conversation

@mirkoalicastro

Copy link
Copy Markdown
Contributor Author

Sorry, I don't really see the value in this. I don't see the problem with these tests depending on Hamcrest via JUnit4. Maybe I am missing the context from ten years ago, but I'd prefer just removing the TODO.

If we want to migrate all integration tests to Jupiter JUnit that's another conversation

I get your point about the TODO. I agree that we could simply drop it, but I see it as good hygiene to get rid of JUnit 4 (maintenance mode), and hamcrest also goes away as a side effect. I can retitle the PR as a Jupiter migration instead of removal of hamcrest via the Jupiter migration. The changes stay the same, but it better reflects the PR.

@mirkoalicastro mirkoalicastro changed the title Remove hamcrest from extensions-tests migrating to JUnit Jupiter Migrate extensions-tests to JUnit Jupiter Jul 6, 2026
@jselbo

jselbo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

I guess that makes sense. I still don't think the exclude() in the gradle file is necessary (does JUnit5 even include hamcrest?) so if we drop that and address my comment in PluginStackTraceFilteringTest I'm good with merging this.

@mirkoalicastro

Copy link
Copy Markdown
Contributor Author

I guess that makes sense. I still don't think the exclude() in the gradle file is necessary (does JUnit5 even include hamcrest?) so if we drop that and address my comment in PluginStackTraceFilteringTest I'm good with merging this.

Makes sense to me. I doublecheck and indeed JUnit5 doesn't bring it, so I simply dropped it.

Which comment in PluginStackTraceFilteringTest you meant? I can't see it

@mirkoalicastro
mirkoalicastro requested a review from jselbo July 7, 2026 15:20
Comment thread mockito-core/src/testFixtures/java/org/mockitoutil/TestBase5.java Outdated
@mirkoalicastro
mirkoalicastro requested a review from jselbo July 7, 2026 19:46
@jselbo
jselbo merged commit d8638e1 into mockito:main Jul 7, 2026
20 checks passed
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.

3 participants