@Test
public void testHasPermission() {

    //mockStatic(ContextCompat.class);
    ShadowApplication shadowApplication = Shadows.shadowOf(application);
    // when permission is null
    boolean actual = Utils.hasPermission(application, null);
    assertFalse("hasPermission must return false when permission is null", actual);
    // when permission not null and checkSelfPermission returns permission granted
    shadowApplication.grantPermissions(Manifest.permission.ACCESS_FINE_LOCATION);
    boolean actualWhenPermissionGranted = Utils
            .hasPermission(application, Manifest.permission.ACCESS_FINE_LOCATION);
    assertTrue("hasPermission must return true when permission is granted", actualWhenPermissionGranted);
    // when permission not null and checkSelfPermission returns permission denied
    shadowApplication.denyPermissions(Manifest.permission.ACCESS_FINE_LOCATION);
    boolean actualWhenPermissionDenied = Utils
            .hasPermission(application, Manifest.permission.ACCESS_FINE_LOCATION);
    assertFalse("hasPermission must return false when permission is denied", actualWhenPermissionDenied);
}