Hiteshsai007 commented on PR #12418:
URL: https://github.com/apache/maven/pull/12418#issuecomment-4886817193

   @elharo Thank you for the feedback. That is a completely fair 
point—extracting an internal static method purely to make it testable was 
definitely a smell.
   
   I've pushed a new commit that starts over and follows your suggested 
approach:
   1. Reverted the `applyTemplatePrefix` extraction and put the logic back 
inline where it originally belonged inside `Init.java`'s execution loop.
   2. Wrote a new integration-style test (`InitTest.java`) that tests through 
the existing `Init.doExecute()` API. 
   3. To test the interactive CLI logic without exposing internal state, I used 
Mockito's `MockedConstruction` to mock `ConsolePrompt` and simulate the 
sequence of user inputs that caused the original bug.
   4. Verified that the test successfully fails by reproducing the issue 
(resulting in a saved value without the `env:` prefix), and then applied the 
inline fix to make it pass.
   
   All `maven-cli` tests, spotless, and checkstyle checks are passing locally. 
Let me know if this aligns better with the project's testing patterns!
   


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