There are a few magical things happening here. Let's start with the annotations that we put into the MockPublisherRepositoryTests class:
- The @SpringBootTest annotation's webEnvironment attribute was replaced with WebEnvironment.NONE. This is to inform Spring Boot that we don't want a full application web server to be initialized for this test, since we will only be interacting with the repository object, without making calls to controllers or using any part of the WebMvc stack. We did this to save test startup time, and if one is curious to see the difference, just simply switching it back to the WebEnvironment.RANDOM_PORT value and rerunning the test would show that the time has almost doubled. (On my beefy MacBook Pro, ...