创意由于初始化错误而无法执行单元测试

时间:2019-05-31 10:42:29

标签: java gradle intellij-idea junit

我有gradle个带有单元测试的项目。我想使用Idea执行和调试测试。

当我通过gradle执行测试时-工作正常。

但是当我尝试使用idea上下文菜单(例如run XXXtest)运行它时,会失败并显示错误

org.powermock.reflect.exceptions.FieldNotFoundException: Field 'fTestClass' was not found in class org.junit.internal.runners.MethodValidator.

    at org.powermock.reflect.internal.WhiteboxImpl.getInternalState(WhiteboxImpl.java:581)
    at org.powermock.reflect.Whitebox.getInternalState(Whitebox.java:308)
    at org.powermock.modules.junit4.internal.impl.testcaseworkaround.PowerMockJUnit4MethodValidator.validateTestMethods(PowerMockJUnit4MethodValidator.java:97)
    at org.powermock.modules.junit4.internal.impl.testcaseworkaround.PowerMockJUnit4MethodValidator.validateInstanceMethods(PowerMockJUnit4MethodValidator.java:67)
    at org.junit.internal.runners.MethodValidator.validateMethodsForDefaultRunner(MethodValidator.java:51)
....

出什么问题了? gradle中的依赖项显示powermock 1.6.2junit 4.12

0 个答案:

没有答案