public @ResponseBody
AfPrr shortApprove(@RequestBody AfPrr afPrr, HttpServletRequest request) {
iAfPrrService.shortApprove(afPrr, SessionUtils.getCurUser(request));
return afPrr;
}
现在需要对这个controller方法进行测试
以下是我测试的,不知道怎么传HttpServletRequest 参数过去
@Test
public void shortApprove() throws Exception {
AfPrr afPrr = new AfPrr();
afPrr.setScmPId(1L);
afPrr.setLimit(10);
afPrr.setOffset(1);
List<AfPrr> list = Arrays.asList(afPrr);
String s = JSONObject.toJSONString(list);
this.mvc.perform(MockMvcRequestBuilders.post("/afPrr/shortApprove")
.contentType(MediaType.APPLICATION_JSON)
.content(s))
.andReturn();
}
```
好像是调用.session方法吧