Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All Widgets Test (partial) with some testability refactors. (getodk#1581
) Introduction of a simple dependency injection system through the DependencyProvider interface. In order to properly test all of the different code paths through each of the widgets, we need the ability to override some of the internal functionality. To do this, we need to strip this internal functionality out into an external, replaceable (i.e. mockable) class. This refactor introduces a single use case of this: ActivityAvailability. FormEntryActivity now implements DependencyProvider<ActivityAvailability>, which lets the Widgets downstream know that it can provide an ActivityAvailability object when needed. Normally this is what something like Dagger handles for us, but since we have a rather simple resource lifecycle (FormEntryActivity is always around when Widgets need access to these dependencies), this system does the same basic thing without requiring the mental/educational overhead of introducing Dagger.
- Loading branch information