我正在使用 Powermockito 来模拟和监视静态类。版本:2.0.4
还使用mockito-core版本3.0.0。在我的一个项目中,我能够通过启用这里指定的 mock-maker-inline 来模拟静态 https://github.com/powermock/powermock-examples-maven/blob/master/mockito2/src/test/resources/ org/powermock/extensions/configuration.properties
但是,当我在另一个项目上尝试相同的方法时,遇到以下错误:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.ghx.tpm.api.ISubscribedProductParameterService]: Factory method 'subscribedProductParameterService' threw exception; nested exception is java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
Caused by: java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@614aeccc
Caused by: java.lang.IllegalStateException: Failed to load MockMaker implementation: mock-maker-inline
Caused by: java.lang.IllegalStateException: Internal problem occurred, please report it. Mockito …Run Code Online (Sandbox Code Playgroud)