Testing a Fragment's onCreate method with a savedInstanceState Bundle in Robolectric?

Viewed 1563

I have a Fragment with an onCreate method that does some stuff with the passed in savedInstanceState Bundle. I'm using Robolectric to create an Activity and starting the Fragment with the Activity's FragmentManager.

The problem I'm having is that I can't figure out how to insert a savedInstanceState Bundle from the test code to validate the code path that uses it.

I was hoping that Robolectric had a shadow Fragment that would let me set the bundle directly.

Any ideas?

2 Answers
Related