I am using Robolectric 3.0 (ToT).
In my activity in onCreate
I make following call:
mHandler.postDelayed(mRunnable, 10 * 60 * 1000)
Then in my Robolectric test case I setup the activity and the runnable is immediately started (and as it happens, it calls finish()
). How can I prevent this from happening?
I used ShadowLooper.pauseMainLooper();
which prevents firing of the Runnable
, but that's not a good solution for me. I am sending broadcasts in the test and they don't get received when the main looper is paused. When I unpause it, both the intent is delivered to the broadcast receiver and the Runnable
is run. How can I get broadcast receiver to run, but not the delayed Runnable
.
Aucun commentaire:
Enregistrer un commentaire