0
我有一個簡單的Spring測試春MockMvc校驗體爲空
@Test
public void getAllUsers_AsPublic() throws Exception {
doGet("/api/users").andExpect(status().isForbidden());
}
public ResultActions doGet(String url) throws Exception {
return mockMvc.perform(get(url).header(header[0],header[1])).andDo(print());
}
我想驗證響應主體是空的。例如。這樣做.andExpect(content().isEmpty())