title: How to mock permissions for testing in Android?
body: <p>With Android 6.0 and new permission model, I am checking if the permission exists before performing certain task.</p>
  
  <p>I want to assign these permissions to available and not available for testing purpose. I have a static class to check various permissions depending on the string. </p>
  
  <pre><code>boolean result = ContextCompat.checkSelfPermission(context, name) == PackageManager.PERMISSION_GRANTED;
  </code></pre>
  
  <p>Can it be achieved using Mockito or Roboelectric?</p>