我继承了一个 Spring 项目,该项目有大约 160 个失败的 Mockito 类 JUnit 测试
当我检查 Jenkins 时,我发现每个测试都有以下错误详细信息:
Receiver class org.powermock.api.mockito.internal.exceptions.StackTraceCleanerProvider$1 does not define or inherit an implementation of the resolved method 'abstract boolean isIn(java.lang.StackTraceElement)' of interface org.mockito.exceptions.stacktrace.StackTraceCleaner.
堆栈跟踪是:
at org.mockito.internal.exceptions.stacktrace.StackTraceFilter.filterFirst(StackTraceFilter.java:110)
at org.mockito.internal.debugging.LocationImpl.computeStackTraceInformation(LocationImpl.java:50)
at org.mockito.internal.debugging.LocationImpl.<init>(LocationImpl.java:35)
at org.mockito.internal.debugging.LocationImpl.<init>(LocationImpl.java:26)
at org.mockito.internal.debugging.LocationImpl.<init>(LocationImpl.java:22)
at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:56)
at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptAbstract(MockMethodInterceptor.java:161)
at org.mockito.codegen.ConfigurationService$MockitoMock$1748841625.getConfiguration(Unknown Source)
at abcproductcomparisonaddon.compareviewproviders.impl.DefaultCompareViewAttributeDataProviderUnitTest.setUp(DefaultCompareViewAttributeDataProviderUnitTest.java:52)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at abc.ant.taskdefs.yunit.JUnitTestRunner.run(JUnitTestRunner.java:649)
at abc.ant.taskdefs.yunit.JUnitTestRunner.launch(JUnitTestRunner.java:1374)
at abc.ant.taskdefs.yunit.JUnitTestRunner.main(JUnitTestRunner.java:1164)```
I cannot find anything related to this error or exception.
I have no config access to the jenkins job, but I have the feeling that the used junit oder Mockito version in Jenkins is outdated.
When I run the tests locally per IntelliJ, i do not get the error.
您的这个问题解决了吗?升级到 hybris 2205 后,我在 spring 应用程序中遇到了同样的问题。到目前为止,我还没有找到任何解决方案。我已经尝试升级mockito-core和powermock jars但没有成功。无论是在 eclipse 中运行,还是通过命令行“ant unittests”运行,我都会遇到同样的错误。