I am trying to write a unit test for a method that depends on the result of ActivityCompat.checkSelfPermission(..)
. To do so, I need to do two things:
call
Robolectric.shadowOf(activity.getApplication).grantPermission(...)
which depends on an Activity built byRobolectric.buildActivity(PictureActivity.class).get()
call
Mockito.verify(activity).someMethod(wasCalled)
which depends on an Activity built by
Mockito.mock(MyActivity.class)
So when I create my Activity with Robolectric, I cannot use the Mockito.verify.
And when I create my Activity with Mockito, I cannot use the Robolectric.grantPermission.
How can I cover this? I'm new with both frameworks, so maybe I am missing something simple.