February 2015
Intermediate to advanced
178 pages
3h 47m
English
The design behind the Spring MVC test is to test the controller by performing actual requests and generating responses, as they would be at runtime. MockMvc is used to mock the servlet container, and it can perform a request and verify the resulting response status and response elements. We'll build a Spring controller to generate a JSON response as in the case of a rest controller and then use MockMvc to unit test the request and the response:
Employee POJO class that holds employee information, such as ID, name, and salary./employees/{id} and /employees/ urls. We'll create a HashMap and store dummy employees. ...Read now
Unlock full access