gnodet-bot commented on code in PR #13539:
URL: https://github.com/apache/maven/pull/13539#discussion_r4294263221
##########
impl/maven-core/src/test/java/org/apache/maven/internal/impl/EventSpyImplTest.java:
##########
@@ -128,6 +141,94 @@ public void sessionStarted(ExecutionEvent event) {
assertEquals(1, calls.get());
}
+ @Test
+ void forwardsSuccessfulDependencyResolution() throws Exception {
+ TestContext context = new TestContext(lookup());
+ RecordingResolutionListener listener = new
RecordingResolutionListener();
+ context.session.registerListener(listener);
+ Dependency dependency = new Dependency(new DefaultArtifact("g:a:1"),
"compile");
+ DependencyResolutionResult result = result(List.of(dependency),
List.of(), List.of());
+
+ EventSpyImpl spy = new EventSpyImpl();
+ DependencyResolutionRequest request = context.resolution();
Review Comment:
💡 **Note:** `matchesResultWithTheLatestRequestWhenAnEarlierOneGotNoResult`
validates request-replacement logic (the `remove()+set()` pattern), but it
would pass identically with a plain `ThreadLocal<DependencyResolutionRequest>`.
The `WeakReference`'s GC-prevention-of-retention benefit is not exercised by
this test. This is acceptable — deterministic GC-dependent tests are fragile —
but worth noting in a comment on the test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]