为什么inteli J不能解决get在我的单元测试?
package com.stev.pillecons.pilleCons;
import com.stev.pillecons.pilleCons.controllers.LePilleController;
import com.stev.pillecons.pilleCons.services.PilleService;
import org.junit.Test;
import org.junit.runner.RunWith;
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.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
@RunWith(SpringRunner.class)
@WebMvcTest(LePilleController.class)
public class UnitTestPille {
@Autowired
private MockMvc mockMvc;
@MockBean
PilleService pilleService;
@Test
public void getAllPille() throws Exception {
mockMvc.perform(get("/api/pille"))
.andExpect(status().isOk())
.andExpect(content())
}
}
所有get()、status()和content()均为红色
1条答案
按热度按时间pftdvrlh1#
您缺少静态导入: