Skip to content

UID2-8117: Load Mockito as a javaagent in surefire (Mockito 5.23.0) - #680

Merged
sunnywu merged 1 commit into
mainfrom
syw-UID2-8117-mockito-javaagent-argline
Oct 21, 2026
Merged

sunnywu merged 1 commit into
mainfrom
syw-UID2-8117-mockito-javaagent-argline

Conversation

@sunnywu

@sunnywu sunnywu commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Load Mockito as a javaagent in surefire instead of letting it self-attach to the JVM at test time.

  • Replace mockito-inline 5.2.0 (redundant on Mockito 5) with an explicit test-scope mockito-core 5.23.0; bump mockito-junit-jupiter to 5.23.0. Mockito 5.14+ is needed for javaagent support.
  • Add maven-dependency-plugin 3.8.1 with the properties goal so ${org.mockito:mockito-core:jar} resolves.
  • Set the surefire argLine to @{argLine} -javaagent:${org.mockito:mockito-core:jar}, preserving the JaCoCo agent set by prepare-agent.

This avoids "Could not self-attach to current VM using external process" failures on newer runner kernels.

🤖 Generated with Claude Code

…23.0

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Ticket: UID2-8117
Branch: syw-UID2-8117-mockito-javaagent-argline
@sunnywu
sunnywu merged commit 8f5aac6 into main Oct 21, 2026
3 of 5 checks passed
@sunnywu
sunnywu deleted the syw-UID2-8117-mockito-javaagent-argline branch October 21, 2026 02:00
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.

2 participants