PowerMock throws NoSuchMethodError (setMockName)
我试图模拟一个构造函数,但每次我运行测试时,我都会得到以下错误:PowerMockito
java.lang.NoSuchMethodError: org.mockito.internal.creation.MockSettingsImpl.setMockName(Lorg/mockito/mock/MockName;)Lorg/mockito/internal/creation/settings/CreationSettings;
at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:107)
at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:60)
at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.createNewSubstituteMock(DefaultConstructorExpectationSetup.java:105)
at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.withAnyArguments(DefaultConstructorExpectationSetup.java:71)
我的项目中有以下PowerMock依赖项:
- org.powermock:powermock-module-junit4:1.5.6
- org.powermock:powermock-mockito-release-full:1.5.6
我已经跟踪了项目的依赖关系树并修复了冲突,以便将其包含在构建中。mockito-all:1.9.5