AbstractPermissionListener implements PermissionListener { @Override public void onPermissionGranted(PermissionGrantedResponse response) { if (userPermissionRequestResponseListener!=null){ userPermissionRequestResponseListener.onPermissionAllowed(true); } } AbstractPermissionListener(ContextProvider contextProvider);  AbstractPermissionListener(UserPermissionRequestResponseListener
      userPermissionRequestResponseListener, ContextProvider contextProvider); @Override void onPermissionGranted(PermissionGrantedResponse response); @Override void onPermissionDenied(PermissionDeniedResponse response); @Override void onPermissionRationaleShouldBeShown(PermissionRequest permissionRequest,
      PermissionToken token); abstract int getPermissionDeniedFeedback(); abstract int getPermissionRationaleMessage(); abstract int getPermissionRationaleTitle();  }
@Test public void responseListenerIsNotCalledWithNullListenerOnPermissionDenied() { DummyPermissionListenerImplementation dummyPermissionListenerImplementation = new DummyPermissionListenerImplementation(contextProvider, stubString); dummyPermissionListenerImplementation.onPermissionGranted( new PermissionGrantedResponse(new PermissionRequest("Test"))); verify(userPermissionRequestResponseListener, never()).onPermissionAllowed(true); }
@Test public void responseListenerIsCalledWithNotNullListenerOnPermissionGranted() { DummyPermissionListenerImplementation dummyPermissionListenerImplementation = new DummyPermissionListenerImplementation(userPermissionRequestResponseListener, contextProvider, stubString); dummyPermissionListenerImplementation.onPermissionGranted( new PermissionGrantedResponse(new PermissionRequest("Test"))); verify(userPermissionRequestResponseListener).onPermissionAllowed(true); }