public static boolean check(@NonNull Fragment fragment, int requestCode) {
    final String[] permissions = getPermissionsStrings(requestCode);
    if (EasyPermissions.hasPermissions(fragment.requireContext(), permissions)) {
      return true;
    } else {
      // Do not have permissions, request them now
      EasyPermissions.requestPermissions(
          new PermissionRequest.Builder(fragment, requestCode, permissions)
              .setRationale(getRationale(requestCode))
              .setPositiveButtonText(R.string.allow_permission)
              .setTheme(R.style.Theme_AppCompat_Dialog_Alert)
              .build());
      return false;
    }
  }
@Test
  @Config(sdk = Build.VERSION_CODES.KITKAT)
  public void testCheckAlreadyHasPermissionsWithM() {
    var appShadow = Shadows.shadowOf(RuntimeEnvironment.getApplication());
    appShadow.grantPermissions(
        Manifest.permission.POST_NOTIFICATIONS, Manifest.permission.READ_CONTACTS);
    try (var scenario = ActivityScenario.launch(TestFragmentActivity.class)) {
      scenario.onActivity(
          activity -> {
            Assert.assertTrue(
                PermissionRequestHelper.check(
                    activity, PermissionRequestHelper.CONTACTS_PERMISSION_REQUEST_CODE));
            Assert.assertTrue(
                PermissionRequestHelper.check(
                    activity, PermissionRequestHelper.NOTIFICATION_PERMISSION_REQUEST_CODE));
          });
    }
  }