Introduction
Dependency Injection (DI) and Inversion of Control (IOC) are the terms that you have to understand to get the most out of the contents of this chapter (for more information, refer to Martin Fowler's article at http://martinfowler.com/articles/injection.html). We will not elaborate on the importance of those two concepts here. We will focus on using them together with Mockito and two Mockito based tools. We'll do that to inject test doubles instead of real beans in our application.
The idea behind integration tests with DI frameworks is that we want the application to have its dependencies already instantiated and injected. We may have fragments of code where we want to send or retrieve data via a web service or a system where a connection to another server is necessary. When performing integration testing, we do not want to have such connections set. Since integration tests are run from our local machines, we want to limit the need for configuring access to those external servers...