I'm trying to test-driven build a simple admin app. The basic idea is to send data (application/json
) between client and server. Therefore I want to test my spring controller using EasyMock
. This would be my controller methods with my given path /user
:
@RequestMapping(method = RequestMethod.GET,
consumes = "application/json", produces = "application/json")
@ResponseStatus(HttpStatus.OK)
public List<User> getUsers() {
return null;
}
@RequestMapping( value = "/create", method = RequestMethod.GET,
consumes = "application/json", produces = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public void create(@PathVariable User user) { }
Now I want to test these two methods. So i mocked my service layer "andReturn" my "expect", which is for getUsers()
simply a list of users or an empty list. But now I'm not sure how to correctly test my response status.