nicoloboschi opened a new pull request #3077:
URL: https://github.com/apache/bookkeeper/pull/3077


   ### Motivation
   
   PowerMockito static mocks don't work well with the latest JDK class 
encapsulation mechanisms. The main problem is that PowerMockito, in order to 
mock a single static method of a class, try to setAccessible a lot of other 
apparently related classes. This means, starting from JDK17, you need to add 
`--add-opens` to the Java runtime options in order to avoid runtime errors.
   
   PowerMockito development isn't much active and they don't seem to be ready 
for the new JDK releases. 
   The best replacement is to use 
[mockito-inline](https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#48)
 (additional part of `mockito-core`), which uses a different algorithm in order 
to mock static methods - a lot less invasive.  
   
   ### Changes
   
   * Mockito upgrade
   * Replaced PowerMockito#mockStatic usages with MockedStatic
   * Added a general purpose helper class with a less verbose API for mocking 
static class and constructions, based on mockito-inline API
   * Modified only the 'tools' module


-- 
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: issues-unsubscr...@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to