Skip to content

Add hamcrest-junit only where org.hamcrest.junit is used - #1314

Merged
timtebeek merged 1 commit into
openrewrite:mainfrom
timtebeek:b11-hamcrest-junit-if-used
Nov 17, 2026
Merged

timtebeek merged 1 commit into
openrewrite:mainfrom
timtebeek:b11-hamcrest-junit-if-used

Conversation

@timtebeek

Copy link
Copy Markdown
Member

Replaces the scanning AddHamcrestJUnitDependency (one assertThat anywhere added hamcrest-junit to every module) with AddDependency using onlyIfUsing: org.hamcrest.junit..*, and moves it after MigrateAssumptions in JUnit4to5Migration, so only modules with MatcherAssume get it. Assert.assertThat now becomes MatcherAssert, which is plain Hamcrest.

Fixes item B11 of #1211.

…igrateAssumptions`

Drop the repo-wide scanner in `AddHamcrestJUnitDependency` and use `AddDependency` with `onlyIfUsing`. `Assert#assertThat` moves to `MatcherAssert` in plain Hamcrest, so only `MatcherAssume` needs `hamcrest-junit`.
@timtebeek
timtebeek enabled auto-merge (squash) November 17, 2026 21:23
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Nov 17, 2026
@timtebeek
timtebeek merged commit cc33fdb into openrewrite:main Nov 17, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Nov 17, 2026
@timtebeek
timtebeek deleted the b11-hamcrest-junit-if-used branch November 17, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant