Setup MockMvc to Test Your Spring MVC @Controller and @RestController in Isolation

This is the first video of the MockMvc mini-series. It covers the reasoning behind writing tests with MockMvc and how to create a MockMvc instance for your test.

Part I: https://youtu.be/sxWNJJ4dKJo
Part II: https://youtu.be/Aasp0mWT3Ac
Part III: https://youtu.be/d7TDoGSZCoc
Part IV: https://youtu.be/oLtXe1wgSC8

Content:

0:00 Why plain unit tests are not enough for your web-layer
2:57 Insights to the @WebMvcTest annotation
4:10 Using the auto-configured MockMvc instance
6:17 Tweak the auto-configured MockMvc configuration
6:46 Create a MockMvc instance based on a WebApplicationContext
8:13 Use the standalone setup for a fine-grained MockMvc configuration

More testing related content is available on my blog: https://rieckpil.de/

» Want to become an expert for testing Spring Boot applications? Join the Testing Spring Boot Applications Masterclass: https://rieckpil.de/testing-spring-boot-applications-masterclass/

» Revamp your Testing Knowledge with this 14 Days Free Email Course on Testing Java Applications: https://rieckpil.de/getting-started-with-testing-java-applications-email-course/

#spring mvc #restcontroller #mockmvc #controller

Setup MockMvc to Test Your Spring MVC @Controller and @RestController in Isolation