此位置不允许使用 @RunWith(PowerMockRunner.class)
@RunWith(PowerMockRunner.class) is disallowed for this location
我遇到以下错误
The annotation @RunWith is disallowed for this location
我有以下导入。
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
@RunWith(PowerMockRunner.class)
@PrepareForTest(QueryValidator.class)
@Test
public void testValidateIds2() { ... }
这是什么原因造成的,我该如何摆脱它。
认为 @RunWith(PowerMockRunner.class)
是 class 级注释,需要位于 class 之上,而不是方法之上。
我遇到以下错误
The annotation @RunWith is disallowed for this location
我有以下导入。
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
@RunWith(PowerMockRunner.class)
@PrepareForTest(QueryValidator.class)
@Test
public void testValidateIds2() { ... }
这是什么原因造成的,我该如何摆脱它。
认为 @RunWith(PowerMockRunner.class)
是 class 级注释,需要位于 class 之上,而不是方法之上。