Introduction to @WebMvcTest
Get introduced to testing utilities in Spring Boot.
Testing in Spring Boot
Spring Boot offers various utilities to start an application for testing, either fully or partially. We can use @SpringBootTest
as a class annotation for a JUnit test which will start our complete application, including an embedded Tomcat to serve the HTML pages.
However, for tests that will only test a controller for example, we don’t need to start the full application.
Spring Boot has test slices that allows us to start, say, only the database layer ( ...