mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-08-07 21:38:44 +00:00
升级springboot4 单元测试报错
This commit is contained in:
parent
e8fedef30f
commit
3a33fc7964
@ -37,6 +37,11 @@
|
||||
<artifactId>spring-boot-properties-migrator</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
|
||||
@ -5,8 +5,8 @@ import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.modules.demo.mock.MockController;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
@ -15,16 +15,17 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
||||
|
||||
/**
|
||||
* 单个controller测试
|
||||
* @date 2025/4/7 11:21
|
||||
*/
|
||||
@WebMvcTest(value = MockController.class)
|
||||
public class MockControllerTest {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@MockBean
|
||||
@MockitoBean
|
||||
private BaseCommonService baseCommonService;
|
||||
@MockBean
|
||||
|
||||
@MockitoBean
|
||||
private JeecgBaseConfig jeecgBaseConfig;
|
||||
|
||||
@Test
|
||||
@ -33,5 +34,4 @@ public class MockControllerTest {
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
.andExpect(MockMvcResultMatchers.status().isOk());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user