title: what is the real use case of dependency injection?
body: <p>I understand <strong>dependency injection</strong> but what i really don't understand is, what is the use of dependency injection. </p>
  
  <p>As it is mentioned <a href="https://stackoverflow.com/questions/130794/what-is-dependency-injection">here</a> this helps in testing your code easily <em>(It's a very useful technique for testing, since it allows dependencies to be mocked or stubbed out.)</em> , but now a days there are lot of mocking frameworks like <a href="https://code.google.com/p/mockito/" rel="nofollow noreferrer">Mockito</a>, <a href="https://code.google.com/p/powermock/" rel="nofollow noreferrer">powermockito</a> which can do these jobs quite well than why dependency injection?</p>
  
  <p>It would be great if somebody could explain with code.</p>
  
  <p>Thanks in advance.</p>