RecordAudioActivity extends AddTranslationActivity { @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { if (permissionService.permissionGranted(grantResults)) { ToastHelper.showToast(this, getString(R.string.record_audio_permission_granted)); } }  @Override void inflateView(); @Override void onCreate(Bundle savedInstanceState); @Override void initStates(); @OnClick(R.id.record_activity_next) void recordActivityNextClick(); @OnClick(R.id.record_activity_back) void recordActivityBackClick(); @OnClick(R.id.record_audio_button) void recordAudioButtonClick(); @OnClick(R.id.play_audio_button) void playAudioButtonClick(); @Override void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);  }
@Test public void shouldShowPositiveToastMessageIfPermissionNotGranted() { RecordAudioActivity activity = (RecordAudioActivity)helper.createActivityToTest(); int grantResults[] = {}; when(permissionService.permissionGranted(grantResults)).thenReturn(true); activity.onRequestPermissionsResult(0, new String[]{}, grantResults); assertEquals(activity.getString(R.string.record_audio_permission_granted), ShadowToast.getTextOfLatestToast()); }