gnodet commented on PR #14218:
URL: https://github.com/apache/maven/pull/14218#issuecomment-7343997300

   Currently, no — `Verifier` does not expose stdin. Looking at 
`Verifier.execute()`, it builds an `ExecutorRequest` and sets 
`stdOut`/`stdErr`, but never calls `.stdIn(...)`. Yet the 
`ExecutorRequest.Builder` in `maven-executor` already has a 
`stdIn(InputStream)` method, so the plumbing is there — it just isn't wired 
through `Verifier`.
   
   For this fix specifically, an IT isn't the right level anyway — the 
behaviour under test is fully inside `LegacyPlexusInteractivity` / 
`DefaultPrompter`, which are plain DI-managed beans. A unit test in 
`maven-compat` that creates a `LegacyPlexusInteractivity` with a mock 
`Prompter` and asserts that `readLine()` returns `""` when the user presses 
Enter is both simpler and more reliable.
   
   If a unit test for `DefaultPrompter` itself is preferred (testing the actual 
JLine path), you can construct one using a `DumbTerminal` piped to a 
`ByteArrayInputStream` with just a newline — `MessageUtils` picks up the 
terminal from a thread-local that can be set before the test.
   
   If you later need a full IT (e.g. to verify archetype behavior end-to-end), 
adding a `setStdIn(InputStream)` to `Verifier` would be the right way to wire 
it through.
   
   _This comment was generated by an AI agent, Hermès on behalf of 
[@gnodet](https://github.com/gnodet)._


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