Skip to content

Improve Gradle agent docs for configuration cache#3823

Merged
raphw merged 1 commit into
mockito:mainfrom
codingkiddo:docs/gradle-agent-config-cache
May 21, 2026
Merged

Improve Gradle agent docs for configuration cache#3823
raphw merged 1 commit into
mockito:mainfrom
codingkiddo:docs/gradle-agent-config-cache

Conversation

@codingkiddo

Copy link
Copy Markdown
Contributor

Summary

This updates the Groovy Gradle example for explicitly attaching Mockito as a Java agent to use CommandLineArgumentProvider.

The previous example accessed configurations.mockitoAgent directly from the test task configuration, which can fail when Gradle configuration cache is enabled. The revised example follows the provider-based pattern suggested in #3822 and keeps the documented setup compatible with configuration-cache usage.

The surrounding wording is also adjusted so it no longer says that CommandLineArgumentProvider is omitted from the examples.

Fixes #3822

Checklist

  • Read the contributing guide
  • PR should be motivated, i.e. what does it fix, why, and if relevant how
  • If possible / relevant include an example in the description, that could help all readers
    including project members to get a better picture of the change
  • Avoid other runtime dependencies
  • Meaningful commit history ; intention is important please rebase your commit history so that each
    commit is meaningful and help the people that will explore a change in 2 years
  • The pull request follows coding style (run ./gradlew spotlessApply for auto-formatting)
  • Mention Fixes #<issue number> in the description if relevant
  • At least one commit should end with Fixes #<issue number> if relevant

Fixes mockito#3822

Signed-off-by: Vinod Kumar <codingkiddo@gmail.com>
Comment thread mockito-core/src/main/java/org/mockito/Mockito.java
@raphw

raphw commented May 21, 2026

Copy link
Copy Markdown
Member

Makes sense to make this the default recommendation to copy-paste.

@raphw raphw merged commit 3b5ba47 into mockito:main May 21, 2026
19 checks passed
@codecov-commenter

codecov-commenter commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #3823   +/-   ##
=========================================
  Coverage     86.84%   86.84%           
  Complexity     3039     3039           
=========================================
  Files           343      343           
  Lines          9167     9167           
  Branches       1135     1135           
=========================================
  Hits           7961     7961           
  Misses          917      917           
  Partials        289      289           

☔ View full report in Codecov by Sentry.
📢 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.

@ccudennec-otto

Copy link
Copy Markdown

Thanks for the PR + adding the example to the docs! 🌻

@codingkiddo

Copy link
Copy Markdown
Contributor Author

Thanks for checking this!

I kept both examples because the existing documentation already included Kotlin DSL and Groovy DSL sections, and this PR only updates the Groovy example to use the configuration-cache-friendly CommandLineArgumentProvider pattern.

That said, I’m happy to adjust the structure if maintainers prefer a simpler docs section — for example, keeping only one example, or updating both Kotlin and Groovy examples to use the same provider-based approach.

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.

Gradle documentation for setting up instrumentation with Gradle configuration cache

4 participants