When I do junit tests, I do something like this to test spring mvc controllers :
request.setRequestURI("/projects/"+idProject+"/modify");
ModelAndView mv = handlerAdapter.handle(request, response, controller);
where controller tested is like :
@RequestMapping(value = "{id}/modify")
public String content(ModelMap model, @PathVariable("id") Project object) {
But I don't find how to get the ResponseBody
answer of request handlers defined like this :
@RequestMapping("/management/search")
public @ResponseBody ArrayList<SearchData> search(@RequestParam("q")) {
....
....
ArrayList<SearchData> datas = ....;
return datas;
}