gnodet opened a new pull request, #24419:
URL: https://github.com/apache/camel/pull/24419

   ## Summary
   
   _Claude Code on behalf of Guillaume Nodet_
   
   Fixes https://issues.apache.org/jira/browse/CAMEL-23904
   
   `CamelBeanDumpTest.testRequestsBeanDumpAndRendersBeans` always fails with a 
`NullPointerException` (ERROR, not assertion FAILURE) because the test 
constructs `CamelBeanDump` directly without picocli command-line parsing.
   
   **Root cause:** Picocli's `@CommandLine.Option(defaultValue = "...")` only 
takes effect during command-line parsing — it does NOT set the Java field's 
initial value. When the command is constructed directly (as in tests), String 
fields remain `null`. The `scope` field being null causes a NPE in 
`matchesScope()`'s switch statement, since Java's `switch` on a null String 
throws NPE.
   
   **Fix:**
   - Add Java field initializers (`= "name"`, `= "all"`) to String fields in 
`CamelBeanDump` matching their picocli `defaultValue`, so the command works 
correctly when constructed outside of picocli parsing
   - Set the missing `scope` and `nulls` fields in the test to match the 
picocli defaults
   
   ## Test plan
   
   - [x] `CamelBeanDumpTest` passes (both test methods)
   - [x] Module builds successfully (`mvn -DskipTests install`)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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