@Test
public void testHasBackgroundLocationPermission() {

    // when SDK Level is less than Q
    Whitebox.setInternalState(Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.P);
    boolean actualWhenSdkIsP = Utils.hasBackgroundLocationPermission(application);
    assertTrue("hasBackgroundLocationPermission must return true when sdk int is less than Q", actualWhenSdkIsP);
    // when SDK Level is greater than P and permission denied
    Whitebox.setInternalState(Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.Q);
    shadowApplication.denyPermissions(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
    boolean actualWhenPermissionDenied = Utils.hasBackgroundLocationPermission(application);
    assertFalse("hasBackgroundLocationPermission must return false when permission " +
            "is denied and sdk int is greater than P", actualWhenPermissionDenied);
}