Repository navigation
Conversation
…king and remove javaagent The test used mockStatic(LoggerFactory.class) only to inject a mock logger and verify debug message ordering. This required a Mockito javaagent (-javaagent:mockito-core.jar) which in turn required the dependency:properties goal to resolve the agent path, adding full transitive dependency resolution to the build (a scheduling barrier in concurrent builds). The structural invariants under test (realm identity, parent classloader, artifact inclusion/exclusion based on file presence) are verifiable directly from the ClassRealm without any logger involvement. The debug message order is an implementation detail, not a testable contract. Rewrite the test to assert only the structural outcomes. Remove the dependency:properties execution, the mockito profile, and all argLine.mockito plumbing from the root POM.
gnodet
marked this pull request as ready for review
November 30, 2026 23:30
gnodet-bot
approved these changes
Dec 1, 2026
gnodet-bot
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Clean removal of Mockito static mocking and javaagent infrastructure. The rewritten test (testProjectRealmIncludesArtifactsWithFileAndExcludesOthers) preserves all meaningful behavioral assertions — realm identity, parent classloader, artifact inclusion/exclusion by file presence — while correctly dropping the debug-log-ordering verification that was testing an implementation detail, not a behavioral contract.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove the Mockito javaagent from the Maven build by rewriting the one test that required it.
Root Cause
DefaultClassRealmManagerTestusedMockito.mockStatic(LoggerFactory.class)to inject a mock logger and verify debug message ordering. Static mocking requires ByteBuddy instrumentation, which on JDK 21+ cannot self-attach without an explicit-javaagent:mockito-core.jar.To supply the agent path, the build used
dependency:properties— which triggers full transitive dependency resolution and sets${org.mockito:mockito-core:jar}as a property. This introduced two problems:dependency:propertiesforces full transitive resolution, creating a scheduling barrier in concurrent builds (all transitive reactor JARs must be built before the mojo can run)dependency:properties→ property → profile activation →argLine.mockito) adds unnecessary complexity for a single testFix
The test was verifying two distinct things:
The debug message assertions (
testDebugEnabled/testDebugDisabled) verify that different log messages are emitted depending onisDebugEnabled(), but the structural outcome (which artifacts end up in the realm) is identical in both cases. TheisDebugEnabled()guard is a performance optimization, not a testable behavioral difference.Rewrite as a single test asserting only the structural outcomes directly from the
ClassRealm. Remove:mockStatic(LoggerFactory.class)and all Mockito static/InOrder importsdependency:propertiesplugin execution (prepare-for-mockito-agent)mockitoprofile andargLine.mockitopropertyargLine.mockitoplaceholder from<properties>Tests
The rewritten
testProjectRealmIncludesArtifactsWithFileAndExcludesOtherscovers all the meaningful invariants previously spread across two tests.Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet