Implementation of the FooterActions following the MAD (1/3)
This CL provides most of the implementation of the QS FooterActions following the modern Android architecture. In particular, this CL includes: - repositories in the data layer. - an interactor in the domain layer. - a view model in the ui layer. The ViewBinder is added in ag/19674347, given that it comes together with changes to the existing XML files. Note that after this CL, the new implementation will still not be used as it won't be wired yet. This is done in ag/19674347. The highest value of the tests is in FooterActionsViewModelTest, which focuses on testing the *state* (view model) of the footer actions using the *real implementation* of the repositories, interactor and viewModel all together. To do so, I implemented a FooterActionsUtils class that allows to *easily* create real implementations of those repositories, interactor and view model, without requiring the caller to provide any parameter. I believe that this is even better than introducing new fakes, and it should hopefully lead us towards using more and more of the real implementations in our tests, and less and less of fakes/mocks, making the tests much more useful. Of course, I still had to use fake & mocks for the classes I'm calling to and for which instantiating the actual object is too painful. As you can see, there are no test files for the repositories: given that we already use the real implementations in the ViewModel tests, they are defacto already tested. I still added some tests on *interactions* (not *state*) in FooterActionsInteractorTest. Even though I believe those tests don't provide much value (they are merely a copy/paste of the implementation), I preferred keeping the same coverage as the current tests (some of which are going to be removed in ag/19674347). Note that the business logic contained in this CL was mostly copy/pasted from the current implementation, as I wanted to make sure that this is going to be a pure refactoring that does not change the logic of this feature. Still, I left some TODOs in the code for potential improvements. Bug: 242040009 Test: atest FooterActionsViewModelTest Test: atest FooterActionsInteractorTest Change-Id: Ia0bdf9824e098ad6604709f5db87576437b0a904
Loading
Please register or sign in to comment