It is not possible to mock static methods of java.lang.System to avoid interfering with class loading what leads to infinite loop
时间: 2024-05-25 07:13:45 浏览: 513
微信小程序实现收货地址城市选择效果mock.js
That is correct. Java's class loading mechanism relies on the static methods of `java.lang.System`, such as `System.out` and `System.err`, which cannot be mocked using traditional mocking frameworks. As a result, attempting to mock these static methods can cause interference with the class loading process and may result in an infinite loop or other unexpected behavior. To avoid this, it's best to avoid mocking these static methods altogether.
阅读全文