A WebApplicationContext represents an application’s web configuration, including its controllers and the components they need. In a controller integration test, inject it and use MockMvcBuilders.webAppContextSetup(context).build() to create a client for calling endpoints. section 16.2
Testing a transfer endpoint
Use MockMvc to send a simulated POST request to /transfer. The test can keep the web setup while replacing the repository with a mock, then check the endpoint’s response. section 16.2
Figure 16.2 A controller integration test. A tool such as MockMvc lets the test execute the web layer without starting a real server. The test sends a simulated HTTP request to the controller, while the developer decides which objects in the request-processing flow are real and which ones are replaced with mocks.

Shows how MockMvc exercises the web layer without starting a real server, while allowing selected objects to be mocked. section 16.2
