Grokking Spring Boot
0% completed
Testing the HTTP Layer
The booking team had a test for a bad event id. It sent GET /events/abc/seats through MockMvc, expected 400 Bad Request, and passed. The same request, sent to the service running on a real embedded server, received 401 Unauthorized.
Neither result was wrong. The two requests took different paths, because MockMvc is not a server. One step that a real server performs after an error never happens inside MockMvc, and that step was where the 401 came from.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%