2017-09-26 30 views
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())

回答