In this episode, we continue the implementation of the
NavigationControllerRouter by creating an abstract factory protocol, a factory test stub and a new type representing a
As discussed in the previous episode, we decided to create an abstract factory to decouple the Routing module from the UI module, maintaining our architecture clean and flexible. To achieve that we create a factory protocol, agnostic of concrete implementations.
Just as our routing module shouldn't unnecessarily depend on other modules, neither should our routing tests. This will facilitate testing in isolation. To achieve this level of decoupling, we introduce a factory stub implementation to help us test the abstract factory usage in the
As we’re testing the
NavigationControllerRouter, we face a common
UIKit problem that makes testing harder: asynchronous animation behavior. We show a simple and efficient solution to bypass it with a safe subclassing strategy.
Finally, we spike some solutions for adding a
Question type. We decide to use an enum to box generic types and we test-drive its