Automatic mock instantiation in a Spring JUnit test
问题 I have a Spring XML bean definition that I want to write integration tests for. The XML bean definition is part of a larger application context where several such files are included using <import> . Inside the definition, I reference several beans that are coming from other files. For my integration test I would like to instantiate the definition standalone and use Mockito mocks for all other beans. Until now, I am using something like this: FooIntegrationTest.java @RunWith