gnodet-bot commented on code in PR #13569:
URL: https://github.com/apache/maven/pull/13569#discussion_r4299597875


##########
impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/StrategyOrchestratorTest.java:
##########
@@ -227,6 +227,27 @@ void shouldExecuteStrategiesInPriorityOrder() throws 
Exception {
     @DisplayName("Result Aggregation")
     class ResultAggregationTests {
 
+        @Test
+        @DisplayName("should describe modifications as planned in dry-run 
mode")
+        void shouldDescribeModificationsAsPlannedInDryRunMode() throws 
Exception {
+            UpgradeContext context = Mockito.spy(createMockContext());
+            context.setDryRun(true);
+            Map<Path, Document> pomMap = Map.of(Paths.get("pom.xml"), 
mock(Document.class));
+
+            when(mockStrategies.get(0).isApplicable(context)).thenReturn(true);
+            when(mockStrategies.get(0).apply(Mockito.eq(context), 
Mockito.any()))
+                    .thenReturn(
+                            new UpgradeResult(Set.of(Paths.get("pom.xml")), 
Set.of(Paths.get("pom.xml")), Set.of()));
+            
when(mockStrategies.get(1).isApplicable(context)).thenReturn(false);
+            
when(mockStrategies.get(2).isApplicable(context)).thenReturn(false);
+
+            orchestrator.executeStrategies(context, pomMap);
+
+            verify(context).action("1 POM(s) would be modified");

Review Comment:
   ⚠️ **Test/code mismatch — CI failure**
   
   This assertion expects `"1 POM(s) would be modified"` but 
`StrategyOrchestrator.logStrategyResult()` now emits `"POMs"` (not `"POM(s)"`), 
causing a test failure:
   
   ```
   [ERROR] 
StrategyOrchestratorTest.shouldDescribeModificationsAsPlannedInDryRunMode
   Argument(s) are different! Wanted:
     upgradeContext.action("1 POM(s) would be modified")
   ```
   
   The fix was to resolve the inconsistency between `"POM(s)"` and `"POMs"` — 
the production code was updated to `"POMs"` but this test assertion was left 
with the old `"POM(s)"` form.
   
   Fix the assertion:
   
   ```suggestion
               verify(context).action("1 POMs would be modified");
   ```



-- 
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]

Reply via email to