gnodet-bot commented on code in PR #1774:
URL: https://github.com/apache/maven/pull/1774#discussion_r4328027492
##########
impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultModelBuilderTest.java:
##########
@@ -374,10 +374,6 @@ public void
testResolvedDependencyParentCacheDoesNotShareActivationWithProjectPa
assertEquals("activated",
projectParentModel.getProperties().get("profile.property"));
assertEquals("activated",
projectParentModel.getProperties().get("profile.condition"));
assertEquals("activated",
projectParentModel.getProperties().get("profile.jdk"));
- // POM-declared property via <condition>: doReadAsParentModel() passes
parent.getProperties()
- // into the activation context (start(parent.getProperties())), so
getModelProperty() returns
- // the real POM property and the condition fires for the non-sandboxed
project parent path.
- assertEquals("activated",
projectParentModel.getProperties().get("profile.pom.condition"));
assertTrue(projectParentModel.getRepositories().stream().anyMatch(r ->
"profile-repo".equals(r.getId())));
Review Comment:
🔍 **Missing negative assertion for `profile.pom.condition` in the
project-parent path.**
The assertion `assertEquals("activated", ..., "profile.pom.condition")` was
removed because `start(Map)` no longer exposes parent properties through
`getModelProperty()`. This is correct. But now there is no assertion verifying
the new behavior — that `profile.pom.condition` is NOT activated in the
project-parent path (which is the intent of #13390). A future regression that
re-enabled self-activation would pass this test silently.
Add the negative assertion to lock in the intended behavior:
```suggestion
assertTrue(projectParentModel.getRepositories().stream().anyMatch(r
-> "profile-repo".equals(r.getId())));
// After #13555, parent POM properties are NOT exposed through
getModelProperty() in the
// project-parent activation path — condition profiles relying on
POM-declared properties
// must not self-activate (#13390).
assertNull(projectParentModel.getProperties().get("profile.pom.condition"),
"profile.pom.condition must not self-activate in the
project-parent path");
```
--
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]