I don't cover testing explicitly in the book, but I do have a few tests sprinkled around in the book and in the sample code that accompanies the book. In short, using Spring Boot you just annotate your test class with @SpringBootTest and @RunWith(SpringRunner.class) and then @Autowire any beans you want to test into the test class itself.
To get you started, if you create a new project using the Initializr (start.spring.io), you will get a *very* simple test that proves that the application context loads cleanly. Looks a little like this:
You would, of course, write more tests (using this as a template) to assert application/component behavior.
Julian Isaac wrote:What's the quickest and easiest way to create a Spring context to use in junit test classes?
Are there strategies for this covered in the book?