ascheman opened a new pull request, #12384:
URL: https://github.com/apache/maven/pull/12384

   ### What
   Adds `DefaultLookupTest` (maven-core) — the regression test that the NPE fix 
in #12336 shipped without.
   
   ### Why
   #12336 changed `DefaultLookup.lookupOptional(...)` to use 
`Optional.ofNullable` instead of `Optional.of`, so a `null` component lookup 
returns an empty `Optional` instead of throwing `NullPointerException`. Nothing 
currently guards that behavior — reverting the fix goes undetected by the suite.
   
   ### Test
   `DefaultLookupTest` covers both `lookupOptional` overloads:
   - container returns `null` -> empty `Optional` (the guarded NPE case)
   - container returns a value -> present `Optional`
   - `ComponentLookupException` whose cause is `NoSuchElementException` -> empty
   
   Verified locally: green on current master; reverting `ofNullable`->`of` 
turns the two null-case tests red with the NPE from `java.util.Optional.of`. No 
production code change.
   


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