Now that we have created our first test, let's examine the code in detail.
We will first look at the following annotations that have been declared for the BookPubApplicationTests class:
- @RunWith(SpringRunner.class): This is a standard JUnit annotation that we can configure so as to use the SpringRunner, providing functionality to bootstrap the Spring Boot framework to the standard JUnit tests.
- @SpringBootTest(webEnvironment=SpringBootTest.WebEnvironment.RANDOM_PORT): This is an annotation that marks the class as a Spring Boot test. It will use the Spring Boot framework to configure the test class instance, provide appropriate configuration, autowiring, and so on. The webEnvironment=SpringBootTest.WebEnvironment.RANDOM_PORT ...