deviant
05/19/2017, 8:20 AMViewModel
. Of course we can use AndroidViewModel
which receives Application
as a constructor param. But in this case we expose android implementation and can't easily test our ViewModel
with unit tests (without mocking the app)aidanvii
05/19/2017, 8:24 AMViewModel
, I would create an wrapper of Resources
and inject it via the constructor, perhaps provide an android implementation as a default constructor parameter, then you could mock it in tests easily.aidanvii
05/19/2017, 8:35 AMaidanvii
05/19/2017, 8:38 AMaidanvii
05/19/2017, 8:38 AMaidanvii
05/19/2017, 8:40 AMaidanvii
05/19/2017, 8:41 AM