Custom test slice with Spring Boot 1.4
Spring Boot 1.4 includes a major overhaul of testing support and one of these features is test slicing. I'd like to take the opportunity in this blog post to further explain what it is and how you can easily create your own slices.
Test slicing is about segmenting the ApplicationContext
that is created for your test. Typically, if you want to test a controller using MockMvc
, surely you don't want to bother with the data layer. Instead you'd probably want to mock the service that your controller uses and validate that all the web-related interaction works as expected. This can be summarized in…