单元测试都是怎么测试的,权限怎么校验的,可否提供demo样例
版本:renren-security 2.5 |
开发环境: |
我是模拟系统的消息通告,做一个demo单元测试,过程如下,报错,
大家单元测试是如何写的呢,也可以分享一下,非常感谢。
@Test
public void demo() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/sys/notice","json")
.contentType(MediaType.APPLICATION_JSON_UTF8) //数据的格式
.accept(MediaType.APPLICATION_JSON_UTF8)
.param("id","fdac78313cb14597dbe075ee21a0d461")
)
.andExpect(status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
System.out.println(mvcResult.getResponse().getContentAsString());
}
会报200 405