I've written a real-time subsystem for Android that I'd like to test on the desktop. I would like to run tests via a command line tool of my creation. The subsystem depends on Android as follows:
- android.os.Looper
- android.os.Handler (including Handler.Callback)
- android.os.Message
- android.util.Log
I need to stub these classes. Robolectric stubs these classes but apparently doesn't allow for custom instances of Looper. Unless someone can point me to functional stubs, I plan to write them myself. I'd rather avoid the complexity of writing a test harness for a full Android emulator.
How do I get Android Studio to use my stubs for these classes in my tool build? I don't want to modify the subsystem to dynamically receive the classes it should use, out of fear of limiting optimization or making code unnecessarily messy. (But I am open to wrapping android.util.Log.)
Thanks for your help!