I'm trying to use MVP to increase unit testing and run tests faster (because I'm testing logic, not Android code, so I avoid using things like RobotElectric).
But I use RXAndroid, and I need Looper to get Schedulers.io() and AndroidSchedulers.mainThread() , and when I try to run something like
class Phone { public Observable<> sendSms(String number){
I get:
Caused by: java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked. See http://g.co/androidstudio/not-mocked for details. at android.os.Looper.getMainLooper(Looper.java) at rx.android.schedulers.AndroidSchedulers.<clinit>(AndroidSchedulers.java:27) ... 28 more
I tried:
android { // ... testOptions { unitTests.returnDefaultValues = true } }
But this will not work, because I want to run full JUnit tests, not Roboelectric or Espresso.
How can i do this? Is there any Planner that won't crash because of this?
source share