@Test
public void shouldNotifyPermissionIsGrantedWhenItsActuallyGranted() throws Exception {

  Permission permission = getPermission();
  PermissionEntity permissionEntity = getPermissionEntity();
  when(mockPermissionEntityDataMapper.transformInverse(permission)).thenReturn(permissionEntity);
  when(mockAndroidPermissionChecker.checkSelfPermission(any(Context.class),
      same(permissionEntity))).thenReturn(0);
  when(mockAndroidPermissionChecker.isGranted(0)).thenReturn(true);
  Single<Boolean> isGranted = permissionActionProvider.isGranted(permission);
  assertThat(isGranted).isNotNull();
  TestObserver<Boolean> testObserver = isGranted.test();
  testObserver.assertNoErrors();
  List<Boolean> streamValues = testObserver.values();
  assertThat(streamValues).isNotNull();
  assertThat(streamValues.size()).isEqualTo(1);
  assertThat(streamValues.get(0)).isTrue();
}