DexterInstance { void onPermissionRequestDenied(Collection<String> permissions) { updatePermissionsAsDenied(permissions); } DexterInstance(Context context, AndroidPermissionService androidPermissionService,
      IntentProvider intentProvider);   }
@Test public void onPermissionDeniedThenNotifiesListener() { givenPermissionIsAlreadyDenied(ANY_PERMISSION); givenShouldShowRationaleForPermission(ANY_PERMISSION); whenCheckPermission(permissionListener, ANY_PERMISSION); dexter.onPermissionRequestDenied(Collections.singletonList(ANY_PERMISSION)); thenPermissionIsDenied(ANY_PERMISSION); }
@Test public void onPermissionDeniedDoSequentialCheckPermissionThenNotifiesListener() throws InterruptedException { givenPermissionIsAlreadyDenied(ANY_PERMISSION); givenShouldShowRationaleForPermission(ANY_PERMISSION); PermissionListener checkPermissionOnDeniedPermissionListener = givenARetryCheckPermissionOnDeniedPermissionListener(permissionListener); whenCheckPermission(checkPermissionOnDeniedPermissionListener, ANY_PERMISSION); dexter.onPermissionRequestDenied(Collections.singletonList(ANY_PERMISSION)); asyncExecutor.waitForExecution(); thenPermissionIsDenied(ANY_PERMISSION); }
@Test public void onPermissionPermanentlyDeniedThenNotifiesListener() { givenPermissionIsAlreadyDenied(ANY_PERMISSION); givenPermissionIsPermanentlyDenied(ANY_PERMISSION); whenCheckPermission(permissionListener, ANY_PERMISSION); dexter.onPermissionRequestDenied(Collections.singletonList(ANY_PERMISSION)); thenPermissionIsPermanentlyDenied(ANY_PERMISSION); }
@Test public void onPermissionFailedByRuntimeExceptionThenNotifiesListener() { givenPermissionIsChecked(ANY_PERMISSION, PackageManager.PERMISSION_DENIED); givenARuntimeExceptionIsThrownWhenPermissionIsChecked(ANY_PERMISSION); givenShouldShowRationaleForPermission(ANY_PERMISSION); whenCheckPermission(permissionListener, ANY_PERMISSION); dexter.onPermissionRequestDenied(Collections.singletonList(ANY_PERMISSION)); thenPermissionIsDenied(ANY_PERMISSION); }