Robolectric in Android: Testing events?

Viewed 2767

I have written a few tests using robolectric and I now want to do some real test classes.

One thing I notice is that I can't test the events like onCreate, onLocationChanged etc.

What is the standard practice for testing the events?

Should iI extract the code that's inside the events and place them in a method, the event would call the method and also robolectro could call the method, of course the method would need to be public, right?

Also if I wish to test something within my method that is normally a private variable then I would need to add a public getter, right? Can I check this from robolectric?

Is there a better way to expose data to robolectric ?

2 Answers
Related