merlimat opened a new pull request, #25425:
URL: https://github.com/apache/pulsar/pull/25425

   ## Motivation
   Fix compilation/runtime issue in `MultiBrokerLeaderElectionExpirationTest`.
   
   The test uses `when(spy.getDefaultMetadataCacheConfig()).thenReturn(...)` 
which doesn't work correctly with Mockito spies on concrete classes — it 
actually invokes the real method during stubbing setup. Also, the 
`MetadataCacheConfig.builder().build()` returns a raw type that needs proper 
generic casting.
   
   ## Modifications
   - Changed `when(spy).thenReturn()` to `doReturn().when(spy)` pattern for 
correct Mockito spy behavior
   - Added proper `@SuppressWarnings("unchecked")` cast for 
`MetadataCacheConfig<Object>`
   - Added missing `import static org.mockito.Mockito.doReturn`
   
   ## Documentation
   - [x] `doc-not-needed`
   
   ## Matching PR in forked repository
   _No response_


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