如何解决:java.lang.IllegalStateException:无法初始化插件:interface org.mockito.plugins.MockMaker(可选:null)
我正在研究junit,下面是我的测试用例:如何解决:java.lang.IllegalStateException:无法初始化插件:interface org.mockito.plugins.MockMaker(可选:null),java,spring-boot,junit,plugins,mockito,Java,Spring Boot,Junit,Plugins,Mockito,我正在研究junit,下面是我的测试用例: @RunWith(MockitoJUnitRunner.class) public class ControllerTest { @InjectMocks Controller controller; @Test public void testPing() { ResponseEntity<String> expected = new ResponseEntity<>(HttpStatus.OK.name(), H
@RunWith(MockitoJUnitRunner.class)
public class ControllerTest {
@InjectMocks
Controller controller;
@Test
public void testPing() {
ResponseEntity<String> expected = new ResponseEntity<>(HttpStatus.OK.name(), HttpStatus.OK);
ResponseEntity<String> actual = controller.ping();
assertEquals(expected, actual);
}
}
@RunWith(MockitoJUnitRunner.class)
公共类控制器测试{
@注射模拟
控制器;
@试验
公共无效测试ping(){
ResponseEntity expected=新的ResponseEntity(HttpStatus.OK.name(),HttpStatus.OK);
ResponseEntity实际值=controller.ping();
资产质量(预期、实际);
}
}
我有以下依赖项:
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>1.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.9.3</version>
</dependency>
org.powermock
powermock-api-mockito2
1.7.4
测试
org.mockito
莫基托磁芯
2.23.4
测试
net.bytebuddy
字节伙伴
1.9.3
如何解决此问题,请提出建议