我正在尝试对Spring 4.0.0 MVC应用程序进行单元测试.
我的控制器定义如下:
@Controller
@RequestMapping("/test")
public class TestCtrl {
@Autowired
private TestService testService;
@Autowired
private TestRessourceAssembler testRessourceAssembler;
@Autowired
private ResponseComposer responseComposer;
@RequestMapping(value = "", method = RequestMethod.GET,produces = "application/json")
public HttpEntity showAll(Pageable pageable) {
Page patr = testService.getAll(pageable);
return responseComposer.composePage(patr,testRessourceAssembler);
}
@RequestMapping(value = "/{name}", method = RequestMethod.GET)
public HttpEntity show(@PathVariable String name) {
Test test = testService.getOne(name);
if(te