Test Driven Development with Alfresco - Part 2 Inversion of Control
In my last post I briefly described the process of TDD. In that discussion I stated that a unit test will test in isolation; meaning that you don't want to test a unit's dependencies only the unit itself. In the real world our code doesn't run in isolation, in the real world our code has dependencies. I also stated that in a future post I would talk about test doubles, however before I can talk about that we need to discuss how we isolate our class from the world around it. Of course we can't isolate it completely, a completely isolated class is generally useless, but we can decrease the dependencies. This dependency on other classes is referred to as coupling and coupling is generally considered bad. An excellent way to reduce coupling is called inversion of control, which is also referred to as dependency injection. Many people when they think of inversion of control think of frameworks such as Spring, JUICE, or Java EE. Although these frame...