https://kotlinlang.org logo
#android
Title
# android
d

deviant

05/19/2017, 8:20 AM
hey guys, have anybody tried https://developer.android.com/topic/libraries/architecture/index.html ? i'm not sure how to fetch resources (strings, colors etc) inside of
ViewModel
. 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)
a

aidanvii

05/19/2017, 8:24 AM
deviant: with
ViewModel
, 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.
👍 1
it doesn’t use ObservableFields though