Use MockMvc to Test a Spring MVC Thymeleaf View @Controller Endpoint

Опубликовано: 07 Август 2026
на канале: Philip Riecks
4,902
87

This is the third video of the MockMvc mini-series. It covers testing a @Controller endpoint that returns a Thymleaf view.

Part I:    • Setup MockMvc to Test Your Spring MVC @Con...  
Part II:    • Perform HTTP GET and POST Requests MockMvc...  
Part III:    • Use MockMvc to Test a Spring MVC Thymeleaf...  
Part IV:    • Test Protected (Spring Security) Controlle...  

Content:

0:00 Introduction to the DashboardController
1:04 Test setup for the @Controller
2:29 MockMvc result expectations for the status, model, and view
4:45 Detailed Console output on failure

Source code: https://github.com/rieckpil/blog-tuto...

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-bo...

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