title: Testing with spring configuration and Mocking objects
body: <p>I am using a spring configuration in testing like below:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = { "classpath:config/spring/config.xml" }) 
  </code></pre>
  
  <p>Let's say I'm testing a service that depends on other services and a repository. Using the <code>@ContextConfiguration</code> these beans will be created and autowired into the service I am testing.</p>
  
  <p>Is it considered better to mock these dependencies and repositories? When creating and loading a test configuration as done currently, a problem in a dependency could cause the test to fail, so I am not really only testing that one service but the other dependencies as well.</p>
  
  <p>Should these dependencies be mocked in the unit test (since you are only supposed to test the functionality of that class and not its dependencies) but instantiated and wired in during integration tests?</p>