【发布时间】:2020-09-10 14:32:26
【问题描述】:
MockMvc 始终为空!我还尝试了其他注释,就像在其他问题中描述的那样,但没有任何效果。
@ExtendWith(SpringExtension.class)
@WebMvcTest(controllers = HelpPageController.class)
public class HelpPageControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
public void test() throws Exception {
//other code
ResultActions result = mockMvc.perform(MockMvcRequestBuilders.get("/help/manuals"));
//other code
}
【问题讨论】:
-
看看下面的链接:spring.io/guides/gs/testing-web
标签: spring testing null autowired mockmvc