【发布时间】:2017-07-11 19:53:25
【问题描述】:
我有一个简单的测试:
@RunWith(SpringRunner.class)
@WebMvcTest(MainController.class)
public class MainControllerTest extends ControllerTest {
@Autowired
private MockMvc mvc;
@MockBean
private Storage storage;
@MockBean
private PersonListMarshaller marshaller;
@Test
public void getTest() throws Exception{
mvc.perform(get("/"))
.andExpect(status().isOk())
.andExpect(view().name("index"));
}
@Test
public void postTest() throws Exception{
}
}
在我想调用的 postTest() 方法中:
mvc.perform(post("/")).param(...); 我对“param()”部分有疑问,因为 intelliJ Idea 无法识别该方法。我搜索了文档,也没有找到。不过,我已经看到人们在各种与 spring 相关的站点中使用它(以及其他一些我无法使用的方法)。为什么我不能使用它?
【问题讨论】:
标签: spring spring-mvc junit mockito