PowerMockito-错误-NoSuchMethodError-WhiteboxImpl

时间:2019-04-29 02:44:24

标签: powermockito

尝试使用PowerMockito.whenNew()时,出现以下错误:

示例代码段:

mockedA = Mockito.mock(A.class); PowerMockito.whenNew(A.class).withNoArguments()。thenReturn(mockedA);


java.lang.NoSuchMethodError:org.powermock.reflect.internal.WhiteboxImpl.getOriginalUnmockedType(Ljava / lang / Class;)Ljava / lang / Class;     在org.powermock.api.mockito.internal.expectation.AbstractConstructorExpectationSetup.createNewSubstituteMock(AbstractConstructorExpectationSetup.java:35)处     在org.powermock.api.mockito.internal.expectation.AbstractConstructorExpectationSetup.withNoArguments(AbstractConstructorExpectationSetup.java:98)


pom.xml依赖项:

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-core</artifactId>
        <version>1.6.6</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4</artifactId>
        <version>1.6.6</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-testng</artifactId>
        <version>1.6.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4-rule-agent</artifactId>
        <version>1.6.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito</artifactId>
        <version>1.7.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.10.19</version>
        <scope>test</scope>
    </dependency>

有人可以在这里帮助我吗?

0 个答案:

没有答案