Skip to content

Replace deprecated mockito-inline 4.0.0 with mockito-core 5.18.0 - #200

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1785171649-upgrade-mockito-core-5.18.0
Open

Replace deprecated mockito-inline 4.0.0 with mockito-core 5.18.0#200
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1785171649-upgrade-mockito-core-5.18.0

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Replaces the deprecated org.mockito:mockito-inline artifact with org.mockito:mockito-core 5.18.0. mockito-inline was deprecated because the inline mock maker became the default mock maker inside mockito-core 5.x, so this is an artifact removal plus a version bump, not a re-add. Zero source changes were needed.

Coordinate diff

-    testImplementation 'org.mockito:mockito-inline:4.0.0'
+    testImplementation 'org.mockito:mockito-core:5.18.0'

+ext['mockito.version'] = '5.18.0'
+ext['byte-buddy.version'] = '1.17.5'

5.18.0 is the newest stable mockito-core on Maven Central (published 2025-05-20; no newer non-prerelease exists). Mockito 5 requires Java 11+, which this project already targets (sourceCompatibility = 11).

Why the ext overrides

The Spring Boot 2.6.3 BOM manages mockito.version (4.0.0) and byte-buddy.version (1.11.x). Bumping only the testImplementation line leaves mockito-core / mockito-junit-jupiter pulled transitively via spring-boot-starter-test, mybatis-spring-boot-starter-test and graphql-dgs-platform-dependencies pinned at 4.0.0 / 3.3.3 — a split classpath. Overriding the managed properties moves the whole family in lockstep. byte-buddy 1.17.5 is what mockito-core:5.18.0's POM requires; the BOM-managed 1.11.x is too old for it.

Nothing else in build.gradle was touched (no Spring Boot, dependency-management, DGS or other dependency changes).

dependencyInsight evidence — the new version actually resolves

./gradlew dependencyInsight --configuration testRuntimeClasspath --dependency org.mockito

org.mockito:mockito-core:5.18.0
org.mockito:mockito-core:{prefer 3.3.3} -> 5.18.0   (graphql-dgs-platform-dependencies:4.3.1)
org.mockito:mockito-core:4.0.0        -> 5.18.0     (spring-boot-starter-test:2.6.3)
org.mockito:mockito-junit-jupiter:5.18.0
org.mockito:mockito-junit-jupiter:{prefer 3.3.3} -> 5.18.0
org.mockito:mockito-junit-jupiter:4.0.0 -> 5.18.0

./gradlew dependencyInsight --configuration testRuntimeClasspath --dependency net.bytebuddy

net.bytebuddy:byte-buddy:1.17.5
net.bytebuddy:byte-buddy:{prefer 1.10.20} -> 1.17.5
net.bytebuddy:byte-buddy:1.8.15           -> 1.17.5
net.bytebuddy:byte-buddy-agent:1.17.5

No mockito-inline remains on testRuntimeClasspath, and there is exactly one version of every Mockito artifact.

API migration summary

No source changes needed. Every Mockito usage in the suite is org.mockito.Mockito.when / verify plus Spring's @MockBean — all unchanged between 4.x and 5.x. There is no src/test/resources/mockito-extensions/ directory (the inline mock maker is on by default in 5.x anyway), and there are no mockStatic / MockedStatic / RETURNS_DEEP_STUBS / final-class-mocking usages that Mockito 5 would have tightened. No stale references to the old coordinate exist elsewhere in the repo (docs, CI workflows).

Gate

JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ./gradlew clean test spotlessCheck -x jacocoTestCoverageVerification (JDK 11, matching CI), from a clean tree:

tests failures errors skipped result
baseline on untouched main (3037fa5) 68 0 0 0 BUILD SUCCESSFUL
this branch 68 0 0 0 BUILD SUCCESSFUL

Same test count, zero new failures, spotlessCheck green (spotlessApply run before committing).

Pre-existing on base, not addressed here

  • jacocoTestCoverageVerification fails on main at ~0.33 instruction coverage against the 0.80 rule in build.gradle. CI excludes it (./gradlew clean test -x jacocoTestCoverageVerification) and so does the gate above. The threshold was not lowered and no tests were added to game coverage.
  • Selenium E2E tests (src/test/java/io/spring/selenium) run under the separate seleniumTest TestNG task and are excluded from the test task; they are unaffected by this change and are not part of the gate.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/a59397ae074d418d8de1ad876696d98d
Requested by: @mbatchelor81

Override BOM-managed mockito.version and byte-buddy.version so all mockito artifacts resolve to 5.18.0.
@mbatchelor81 mbatchelor81 self-assigned this Jul 27, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant