In my main activity I observe Livedata and change the background accordingly using getWindow.setBackgroundDrawable(drawable));
My code:
backgroundImageViewModel.getBackgroundImageLive().observe(this, new Observer<BackgroundImage>()
@Override
public void onChanged(BackgroundImage backgroundImage) {
if(backgroundImage == null ||backgroundImage.getDrawable() == null) {
return;
}
Log.d(TAG, "drawable: " + backgroundImage.getDrawable());
getWindow().setBackgroundDrawable(backgroundImage.getDrawable());
}
});
In my espresso test, I update the live data. But how can I test in if the background drawable changed?