赞
踩
jdk11 , junit5 ,springboot
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- mockito static method -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>4.1.0</version>
<scope>test</scope>
</dependency>
@SpringBootTest
class MockStaticTest {
@InjectMocks
TestService testService;
@Test
void apply2() {
try (MockedStatic<TestUtil> mock = Mockito.mockStatic(TestUtil.class)) {
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。