Understanding isolation
As we've just learned, a component under test usually has to collaborate with other components. But why can this be a problem with respect to unit tests, and what are we going to do about it? This section will explain the necessity of testing functionality in isolation. Afterwards, it introduces the so-called test doubles, which we will use later on to achieve this goal.
Delegating responsibilities to DOCs
Now that we've got a pretty good understanding of the timeline's responsibilities, we want to go ahead with development. As we may consider fetching items from a provider as the most valuable functionality on our way to a minimal viable product, [MIVIPR] we decide to continue with page wise fetching.
But we know that a Timeline
component relies on an ItemProvider
instance to make this happen. To implement this dependency, we could choose constructor injection. Indeed, this binds a certain provider statically to a timeline instance, but it avoids any...