Just started to use Robolectric and it seems to be pretty much what I need. However, I've hit a bit of a roadblock with regards to the use of SharedPreferences.
I have two tests cases
Activity expects a new/empty sharedPreferences
Activity expects sharedPreferences with some data in it already
For Test Case 1, the tests are passing as expected, so all good :)
However, for Test Case 2 I can't seem to figure out a nice way to provide Robolectric with some fake data, so the Activity is able to access this fake data.
It feels like a very common use case, but I can't seem to figure out how to do it!
See Question&Answers more detail:os