Closed droidguyg1 closed 9 years ago
One of the easiest ways is to use DI (RoboGuice or Dagger). It will provide you API to provide a test object while you're creating the activity. Otherwise you'd need split object creation and object calling in onStart and onCreate so Robolectric could give a window where to assign a DB mock to your activity.
My NoteView activity in onCreate uses a helper class. I want to test that it calls the helper class correctly. How do I write a robospock test for it? My best shot is: