【发布时间】:2018-11-23 02:51:02
【问题描述】:
我正在为 Spring Boot 中的 REST 控制器编写测试。是使用 is(),但我的 IDE 没有提示这是什么包,所以我找不到它。
这是我的测试方法;
@Test
public void printerIsReady() throws Exception {
/* Set the contents of status.txt to anything other than 3 */
String statusFilePath = printerPath + "/status.txt";
PrinterFileHelper.writeToFile("5", statusFilePath);
this.mockMvc.perform(get("/printer"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.status", is("READY")));
}
我在网上找到了很多使用 is() 方法的示例,但完全不清楚我需要添加什么包才能访问它。
【问题讨论】:
标签: spring-boot